I am trying to write a VBS script that installs a USB / Ethernet adapter in Windows 7.
I have a .INF file for this device.
First I tried:
Dim WshShell, res
Set WshShell = WScript.CreateObject("WScript.Shell")
res = WshShell.Run(WshShell.ExpandEnvironmentStrings( "%SystemRoot%" ) & "\System32\InfDefaultInstall.exe "" C:\Users\Me\Driver.inf """, 1, True)
res equals 2.
Then I searched for another way to do this and I found :
Dim WshShell, res
Set WshShell = WScript.CreateObject("WScript.Shell")
res = WshShell.Run(WshShell.ExpandEnvironmentStrings( "%SystemRoot%" ) & "\System32\rundll32.exe SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 ""Driver.inf""", 1, True)
resis 0, but I have an error popup Installation failed.
What happened to my code? For recording, a script is run with administrator rights.
EDIT
I tried to execute the first command directly in the invitation and received: The inf file you selected does not support this method of installation..
Nothing happens on the command line.
This is very strange, because I can install the driver “manually” when starting the device manager and select the inf file (with a warning:) Windows can't verify the publisher of this driver software.:

, NetCfgx.dll,NetClassInstaller. ?
devcon ( devcon.exe ).