SysPrep in Depth - Part 6 - Bringing Parts 1-5 Together⚓︎
September 28, 2007
Taking Parts 1-5 and Creating your First Image⚓︎
Bringing Parts 1-5 Together⚓︎
Now we have everything lined up we can talk about using a batch file to bring this all together. In this sample script I make use of the optional tool sync.exe from Mark Russinovich and do a few other things we have yet to talk about. Read over the script once and then I will explain as many questions as I can.
Batchfile | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
What does this all mean?⚓︎
I prefer to dis-join pc’s from the domain before running SysPrep, SysPrep does do this for you during its process so this is merely personal preference. Remember to also uninstall all the devices that you can in the Device Manager, right before running this script would be a great time to do this. You also want to have as little running as possible so close out all open windows and as many programs as you can out of the tray. Verify that antivirus programs are not scanning is always a good idea during the sysprep process. You should also open your sysprep.inf file, read any comments and make sure it has all the customizations you want in it. Don’t forget to check your OemPnPDriversPath value to make sure it is up to date.
Now we can get into what the batch file actually does. There are 8 steps to this batch file that actually have an effect on the PC:
- First off I run sync.exe and flush all data to the drive. This is just a precautionary measure but when you are making a clone to be deployed to 600+ computer you want to be as careful as possible.
- Now I start cleaning up all the driver cache files, starting with the infcache.1 files in our drivers folder.
- Now we set the permissions on both the sysprep and drivers folders so that we have no issues with sysprep not being able to use its drivers.
- For the next step we clean all the cached drivers that the current system has created just to make sure sysprep will always use our drivers folder we created.
- Change the “Installation Sources” registry key so that we know yet again no other drivers will be used.
- Run spdrvscn.exe to set yet another registry key to let sysprep know where we have all our drivers stored.
- Close all network connections just as another precautionary step.
- Run sync.exe one last time
Now we get a little notice as to what settings to run sysprep with to get the results we want. Remember that if you are making a clone of this PC, when it turns off is the time to pull the clone. You don’t want to let it turn back on and sysprep start-up until you have cloned this computer out to all your other computer.
Now What⚓︎
There are still further customizations that you can do to your image that we haven’t even talked about. I have mentioned that I will explain the whole PNPID issue and how to fix or avoid issues with it. I also touched on a way that you can have a script type in your product code for you if you don’t have a VLK. This isn’t very useful to most people because if you have 50+ computers you are cloning you probably already own a VLK, but there are people out there that don’t have the VLK and end up typing in 50 different product codes into 50 different computers. There is a legal way around having to type them in by hand actually, so keep checking back for a new SysPrep in Depth that explains this process.