Windows Server Administration

Server Administration Articles and Tips for Network Admins

Add a Custom Script to a Vista Syspreped Image

with 3 comments

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…….

Written by Daniel Anderson

November 28th, 2008 at 11:33 am

Posted in Windows Vista

3 Responses to 'Add a Custom Script to a Vista Syspreped Image'

Subscribe to comments with RSS or TrackBack to 'Add a Custom Script to a Vista Syspreped Image'.

  1. …or you could do this, which works quite well too…with less steps – http://social.technet.microsoft.com/Forums/en-US/itprovistadeployment/thread/2d03e17d-c2ea-4d19-bf32-7db2e9975251#page:1

    See the entry and script/process by MIKE_ECC [MSFT]

    Thanks for posting yours…I liket it as well!!

    System Center Admin

    14 Dec 08 at 6:59 pm

  2. A fantastic read….very literate and informative. Many thanks….where is your RSS button ?

    Speed Up Vista

    27 Apr 09 at 5:09 am

  3. Hey Speed Up Vista, thank for the comment, the RSS Button is the orange one on the right hand side there

    Daniel Anderson

    27 Apr 09 at 9:50 am

Leave a Reply