Injecting Drivers during audit mode for syspreping Windows 7 and then Fogging
-
So,
Everything is working well, but I wanted to remove the driver pack from the machine’s after imaging them because they are almost 2 gigs. So, I wrote a script to remove the unattend.xml file and included to remove the drivers folder. Placed the script in c:\windows\setup\scripts\ folder so it will run automatically after computer finishes its setup.
Real basic, here is what it is -
@echo off
del /Q /F c:\windows\system32\sysprep\unattend.xml
del /Q /F c:\windows\panther\unattend.xml
rmdir c:\drives /Q /SI think this is removing the Drivers directory before windows finishes the drivers install. Any better ideas on how I could accomplish this?
-
Add a script to the END of the setupcomplete.cmd file that runs another script to remove the fill/folder.
Just keep chaining scripts until you accomplish the goal you desire lol
-
LOL Good thought. And, In the end of the script setupcomplete.cmd script put a wait or a pause command to make the computer wait. Gotta look up the commands. I’ll post my finished solution.
-
I do exactly the same to handle drivers except i get the init.gz to detect the machine model, download the relevant drivers folder (drivers in .inf form) from the closest node and then add the registry entry to devpath so all drivers (as long as they’re signed) are handled and installed by sysprep that way i can keep the image small and drivers up to date without having to modify the image - also means i can have one image per OS
-
it also means you do not have to run an additional script after sysprep and i build my images on a VM so that there is bare minimum drivers on the image during audit mode - also means again image can stay small for faster deploys.
-
…i’ll speak to Tom about maybe getting something implemented so any “options/pre-reqs” aren’t hard coded and you can set them from the Web GUI i.e. folder path (C:\Drivers) and maybe have a “Driver Management” page so you can manage the folders without having to do it all back end on the server.
-
Very intriguing and interesting.
If you’re up to the challenge, just do like we normally do.
-
Very interesting Lee,
Can you go into more detail on the process of this for everyone? -
Myself, Tom and james are looking to working on this as a plugin potentially may take sometime… just watch this space
-
Definitely!
-
Good news! There was nothing wrong with the script. It deleted the Drivers folder after they installed collect along with the unattend.xml. Thanks for everyone’s help! it wasn’t until I pushed the image to a different model PC that I noticed it worked correctly. The first one I was using as testing grounds, apparently is missing a driver. Thanks Again!
-
For info, the vbscript function we use to check for presence of a particular device id is below.
This allows us to install the associated software as well rather than just the inf files.
the command line utility Devcon is available from Microsoft at the following link.
[url]http://support.microsoft.com/kb/311272[/url]Function device_present(device)
Dim cmd,oShell,ScriptPath,rexec,strtext
ScriptPath = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - Len(Wscript.ScriptName))
cmd=Scriptpath & “drivers\devcon find " & device & “*”
'msgbox cmd
Set oShell = CreateObject(“WScript.Shell”)
set rexec= oShell.exec(cmd)
strtext=”"
strtext=Ucase(rexec.stdout.readall())
if(InStr(1,strtext,“NO MATCHING DEVICES FOUND”,1) >0 )Then
device_present=false
else
device_present=true
End If
'wscript.echo strtext
End function -
Very nice script!