Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 3

Using pnputil.exe in a CA to install/uninstall drivers not working when deferred execution in system context is set?

Hi all,

I have a question about using pnputil.exe in a Custom Action (New EXE -> Path referencing a directory). The In-Script execution is already set to "Deferred Execution in System Context" which I assume it should execute the command with elevated privileges. Working Directory is also pointing to C:\Windows\System32 folder.

However when I run the .msi installer as admin it will give me an 1722 error when it tries run pnputil.exe custom action. I looked through the verbose logs but doesn't give me much information as well why it returns 1722. 

I ran the same command manually in cmd as admin and it will work fine. Would anyone have any idea why my custom action is not working in the .msi installer but works when I run it manually?

I am also trying to avoid using the built in "Device Driver Wizard" as DIFx has been deprecated awhile ago.


(1) Reply
Level 3

I was able to get a work around in the custom action EXE by running powershell in command line and call pnputil like this:

Command Line: powershell.exe -Command "Start-Process powershell -ArgumentList '-Command pnputil.exe /add-driver \<path to>.inf /install' -Verb Runas"

But it doesn't seem to be a clean solution. Wondering if there are better ways to call pnputil.exe in InstallShield?

0 Kudos