1

I have a Driver called X that manages a hardware component A. I would like to remove that drive and replace it with one called Y that also manages the component A.

So far I have been using .NET Framework 6.0, C# Programming Language, along with PNPUtil.exe to install the driver but I think my method is wrong because I have just been doing the following:

ProcessStartInfo psi = new ProcessStartInfo
                {
                    FileName = "PnPUtil.exe",
                    Arguments = $"-i -a \"{driverFile}\"",
                    UseShellExecute = false,
                    CreateNoWindow = true,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true,
                };

This is just installation and the device in the console says it installed but when I go into the Device Management and look up device by driver I do not find my driver Y. I looking for answer to demonstrate or point to a tutorial on how to do this and if PowerShell can replicate this as well. My OS is Windows 11.

EnlightenedFunky
  • 237
  • 2
  • 11

1 Answers1

1

You install a driver, but whether it's used for a device is depended upon the driver's definition in its .inf file.

Note that if you install an older driver, Windows may automatically update it to a newer version. To block that update see this answer.

The Windows command for installing drivers is PnPUtil, using the command:

pnputil -i -a <driverinf>

If the INF to install has a DefaultInstall section, it can also be installed with this command:

rundll32 advpack.dll,LaunchINFSection <PathTo>\name.inf,,1

If a DefaultInstall section is not present, then you need to find which install-section to call instead using the command:

rundll32 advpack.dll,LaunchINFSection <PathTo>\name.inf,<InstallSection>,1

Sources:

harrymc
  • 498,455