- NSIS Discussion
- Install USB driver / .inf file - pnputil fails
Archive: Install USB driver / .inf file - pnputil fails
Elmi
22nd November 2011 19:32 UTC
Install USB driver / .inf file - pnputil fails
Hi,
I want to install an USB driver via its .inf file using NSIS. I found a Wiki-entry regarding this that recommended to use Microsofts pnputil to add the .inf file to the driver storage.
Unfortunately pnputil fails, it cancels the operation with an error message "Access denied". This is strange because I have administrator privileges.
So what can I do - how can I pre-install a driver/.inf file so that it is used as soon as the related device is attached?
Elmi
T.Slappy
23rd November 2011 08:36 UTC
What version of Windows are you using?
For W2k and XP use these plug-ins: http://nsis.sourceforge.net/Driver_i...ion_and_update and http://nsis.sourceforge.net/InstDrv_plug-in
For Vista and later PnPUtil is better.
Elmi
23rd November 2011 11:36 UTC
Hi,
I'm using Win 7
Elmi
27th November 2011 17:01 UTC
Hi,
I think I found the reason:
when executing pnputil within NSIS using command "Exec" it is NOT executed with administrator privileges although I previously called "RequestExecutionLevel admin".
So how can I execute pnputil WITH admin privileges correctly?
MSG
27th November 2011 17:11 UTC
Are you sure you have administrative access? Note that requestexecutionlevel admin is NOT sufficient to guarantee it - you need to use the userinfo plugin (in .onInit) to verify!
Elmi
27th November 2011 17:28 UTC
I'm sure I don't have administrative access because pnputil fails. Therefore my question: how can I get administrative privileges for "Exec" calls?
Elmi
27th November 2011 18:12 UTC
May be I have to be more detailled:
When using "pnputil" manually I have to run a "cmd.exe" as administrator, elsewhere pnputil fails.
So to execute pnputil out of a NSIS installer I currently execute it using "Exec". But this does not seem to execute it within a "cmd" that has administrator privileges.
So how can I "Exec" it correctly so that the underlying command line environment has the same privileges like a "cmd.exe" that is executed with administrator privileges?
MSG
28th November 2011 06:38 UTC
If your installer isn't at admin level, the pnputil also will not be executed at admin level. To make sure the installer's child processes are admin, make sure the installer is admin. To do this, use the userinfo plugin.
Elmi
20th December 2011 11:07 UTC
Originally posted by MSG
make sure the installer is admin. To do this, use the userinfo plugin.
OK, it tells me I'm not Admin - how do I change that?
Afrow UK
20th December 2011 12:09 UTC
Simplest approach is to bring up a message box and tell the user they must run the installer as an administrator using Run As (and then exit). Another option is you could run the installer again using ExecShell with the runas verb. Last option I suppose is to use the UAC plug-in.
Stu
Elmi
20th December 2011 14:25 UTC
Originally posted by Afrow UK
Simplest approach is to bring up a message box and tell the user they must run the installer as an administrator using Run As (and then exit).
OK, in this case we're back to my original problem: running the installer as Administrator DOES NOT cause pnputil to work properly since the command line that is spawned from such an installer seems not to inherit its privileges!
Theresias
20th December 2011 15:15 UTC
Save yourself the trouble and use DPInst instead, we've wasted our time with several approaches and after having tried them "all" we went with DPInst. In fact at this point we are very glad to have used as it also allows easy un-installation of specific driver versions.
T.Slappy
21st December 2011 09:13 UTC
I can confirm Theresias words: PnPUtil is not working correctly in some cases.
I made drivers installer some time ago and it was too difficult to find out why is PnPUtil causing troubles so I switched to DPInst.
Use DPInst - there is simple example here: http://blogs.technet.com/b/svengruen...pinst-exe.aspx
Also all necessary files are there so you do not need to download whole SDK package.