![]() |
#1 |
Junior Member
Join Date: Nov 2011
Posts: 14
|
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 |
![]() |
![]() |
![]() |
#2 |
Major Dude
|
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. Cool looking installers with custom design: www.graphical-installer.com Create Setup Pages easily: www.install-designer.com Build installers in Visual Studio 2005-2019: www.visual-installer.com or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Nov 2011
Posts: 14
|
Hi,
I'm using Win 7 |
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Nov 2011
Posts: 14
|
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? |
![]() |
![]() |
![]() |
#5 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
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!
|
![]() |
![]() |
![]() |
#6 |
Junior Member
Join Date: Nov 2011
Posts: 14
|
I'm sure I don't have administrative access because pnputil fails. Therefore my question: how can I get administrative privileges for "Exec" calls?
|
![]() |
![]() |
![]() |
#7 |
Junior Member
Join Date: Nov 2011
Posts: 14
|
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? |
![]() |
![]() |
![]() |
#8 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
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.
|
![]() |
![]() |
![]() |
#9 |
Junior Member
Join Date: Nov 2011
Posts: 14
|
|
![]() |
![]() |
![]() |
#10 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
![]() |
![]() |
![]() |
#11 |
Junior Member
Join Date: Nov 2011
Posts: 14
|
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!
|
![]() |
![]() |
![]() |
#12 |
Junior Member
Join Date: Jun 2006
Posts: 48
|
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.
|
![]() |
![]() |
![]() |
#13 |
Major Dude
|
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. Cool looking installers with custom design: www.graphical-installer.com Create Setup Pages easily: www.install-designer.com Build installers in Visual Studio 2005-2019: www.visual-installer.com or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com |
![]() |
![]() |
![]() |
#14 |
Junior Member
Join Date: Jul 2016
Posts: 4
|
Hi Guys
I am having the same problem trying to install an inf file using utilpnp but not succeeding using NSIS.
Someone said use DPInst but did not provide directions. I would prefer to use utilpnp because when I type in the command, the inf file is installed. I just need to be able to do it from within the script. Hence my Installer user will not need to run the script. Please help |
![]() |
![]() |
![]() |
#15 |
Junior Member
Join Date: Jul 2016
Posts: 4
|
Did you solve this problem. How did you solve it. I am having the same problem.
Thanks |
![]() |
![]() |
![]() |
#16 |
Senior Member
Join Date: Nov 2012
Posts: 165
|
code: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx or code: http://msdn.microsoft.com/ru-ru/libr...(v=vs.85).aspx |
![]() |
![]() |
![]() |
|
Tags |
.inf, driver, usb |
Thread Tools | Search this Thread |
Display Modes | |
|
|