Add a Custom Script to a Vista Syspreped Image

Have you ever been in charge of creating and syspreping a Vista Image and needed to have the abiltiy to manually enter a computer name rather than have sysprep randomly generate one?

Well this is the situation I am in at the moment, getting a new Notebook Image, Toshiba M750 Tablet, ready for deployment to about 150 students next year.

In the old days of an XP sysprep you could just leave the computer name blank in the sysprep file and as part of sysprep it would prompt you for the name of the computer. But in Vista there is a bug that if you leave the computer name out sysprep will NOT prompt you for one, and what is worse is that when you try and log in you get this error “The trust relationship between this workstation and the primary domain failed”. The work around for this is to use an asterix for the computer name. It will still generate a random name but at least you can login (this may have been fixed in SP1 though, I have not tested it yet). This is still no good for me.

In my research on how to get sysprep to prompt you for a computer name I found that you can add a custom script to windows setup. This script will run after sysprep is complete and before it gets to the login screen. There is a batch file called SetupComplete.cmd that if present in this location C:\Windows\Setup\Scripts will be executed after Windows has installed but before the login screen. This is GOLD !!!.

Next I got a script that prompts for a name for the computer, a username and password of an account that can change the name of a domain joined computer. VIEW THE VBS SCRIPT HERE.

I copied the script to the C:\Windows\Setup\Scripts folder then created a SetupComplete.cmd file in notepad an placed a call to the vbs script. Now what happens is after sysprep has run and a random computer name is generated and the machine is joined to the domain the machine reboots and you are prompted to change the name of the computer and supply a username and password for this operation to complete.

Job Done…….

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>