Sunday, February 27, 2011 5:01 PM
VBScript To Customize The OS During Deployment
When we deploy operating systems at my work place, we try to utilize a single, small base image, and then layer software and other items on top as the OS is deployed to a machine. Many times we have a need to customize the default OS configurations; either on a reoccurring, or a one-time, basis.
The following VBScript file uses several examples to show ways that you can easily customize your own OS deployments. Please keep in mind that this script has been intentionally slimmed down to help make it easier to understand, and contains very little, or no, error checking.
CustomizeOS.vbs (right-click and save the linked file)
(you will need to save the file and then change the .TXT extension to .VBS)
- Save the "CustomizeOS.vbs" VBScript to a folder on your machine.
- Make sure you right-click the files, selecting Properties, and then Unblock it if the option is shown.
- You may use Notepad if you wish to edit the script.
- Test things to make sure the script will work in your environment:
- Note that the script attempts to copy over some image files if they exist in the same folder as the .VBS file.
- While you can have this script executed a variety of ways due to the power and flexibility of SCCM and task sequences, one quick and easy method is listed here. In our environment we chose this route because we were already mapping to a server to perform other tasks, so it was a simple solution for us.
- Place all of the needed files, including the .VBS file, into a folder, and then create an SCCM Package out of it.
- Before going live with the VBScript, depending on your scripting level, you may wish to enable the currently commented out "On Error Resume Next" statement. This is so that if the script does encounter an error, it quietly fails.
- When creating the Package's Program, set the "Command line" to point to the .VBS file.
- Edit your OS task sequence to add the Package containing your VBScript:
- That should be it. Your OS task sequence should now attempt to perform the customizations in your VBScript at the end of the OS deployment.
NOTE 1: If you use Notepad to edit a VBScript, make sure you disable Word Wrap (Format | Word Wrap) as it makes things easier to read.
NOTE 2: If using Notepad, once you disable Word Wrap you can display line numbers by selecting the View | Status Bar menu item. The line number that the cursor is on will now display in the lower right corner of the window.
Filed under: SCCM, Scripts, VBScript