Batch-File from Snapin is just partially executed
-
Hi!
The first Sanpin copies and extracts the drivers to c:\drivers. The second snapin calls a batch file for installing the drivers using pnputil:install_drivers.bat:
echo Installing Drivers >c:\drivers.log
pnputil.exe /add-driver “C:\Drivers*.inf” /subdirs /install >>c:\drivers.bat
pnputil.exe /add-driver “C:\Drivers*.inf” /subdirs /install >>c:\drivers.bat
echo Finished >>c:\drivers.logThe sanpin is beeing executed. in the drivers.log file I only find:
drivers.log:
Installing Drivers
FinishedI’m wondering why pnputil is completly ignored…
Thanks in advance
-
@Krautkopf said in Batch-File from Snapin is just partially executed:
pnputil.exe /add-driver “C:\Drivers*.inf” /subdirs /install
I see one issue that will cause a problem. Its your path where the drivers are located. So what you have is that pnputil will look in C:\ for any .inf files that match Drivers*.inf.
I assume you have the drivers in “c:\drivers” ? If that is the case you are missing a backslash in front of the start in your command.
i.e.
pnputil.exe /add-driver “C:\Drivers\*.inf” /subdirs /install
The second part is that the log file can’t be created in the root of C drive, so I would change the path to
c:\drivers\install.log
or something like that. I should have posted that ppnputil couldn’t find any driver files. So its strange that the log is blank.Just a side comment, copying over the drivers should be done as a post install script in case you need a driver to boot the system or communicate on the network. Snapins runs after windows is booted, but if the nic driver is missing the target computer will not connect to the network. This is just an opinion, if it works for you the way its configured then you have the right process that works, no need to change.
-
Thanks for the reply!
the backslash just got lost during quickly typing the batch file - in the original file the path was correct. I also changed the path-file now pionting to c:\drivers\drivers.log. Still the logfile conains only the two comments and pnputil is still being ignored. I think I’ll give it a try with your suggested solution of injecting the drivers with the post install script. -
@Krautkopf said in Batch-File from Snapin is just partially executed:
I think I’ll give it a try with your suggested solution of injecting the drivers with the post install script
In my tutorial I deliver the drivers during the post deployment scripts so the drivers are already on the the computer when it boots for the first time into windows and then after oobe completes I have the pnputil command run from the setupcomplete.cmd. The setupcomplete.cmd batch file is run as part of windows oobe and is executed as SYSTEM user.
Now in your case you have one snapin copy the files over and a second snapin install them. The fog client executes the snapins and the fog client runs as SYSTEM user. So in theory it should work.
Here are some random thoughts on the issue
One thing I do is use the
start /wait "" <some_command>
(so in this case the command would bestart /wait "" pnputil.exe /add-driver “C:\Drivers\*.inf” /subdirs /install >>c:\drivers.bat
hint: the 2 double quotes are needed to work around a quirk in the start program) to start a program and then wait for its execution before going on to the next step in the batch file. I’ve ran into situations where a batch file will spawn an application and then not wait before going to the next line in the batch file.Its strange that you are not getting “anything” from the pnputil program. If you log into this computer and run this batch file does it work?
Is it possible that the path variable is not being used during a fog client snapin install where you need to provide the full path to the pnputil.exe program for it to be called.
Another check you might do in this batch file is verify a key or specific file exists in the drivers directory to confirm that the drivers are installed before this batch file runs, or at least log that it found the drivers.
Why not combine the driver copy and uncompressing with this script to install the pnputil command. By using the start /wait command you can ensure the execution is sequentially.