easy way to change PC name during Deployment


I know there are many ways to handle PC naming during deployment, like prestaging, variables, userexit scripts, etc. But a very simple way is to just have the PC prompt you for a Name during The TaskSequece. I wrote a small script that in conjunction wit the fabulous ZTIUtillity.vbs script from MDT does just that.

It is very small and simple script (as I pretty much suck at scripting) so it shouldn’t be hard to get it to work. The script will prompt you for a PCname, and write it to sysprep.inf (if needed on VISTA it must be modified to use Unatended.xml instead)


All you have to do, is place it at the end of your postinstall phase and that is it…




I do recommend that you use the Toolkit feature that comes with integrating MDT into SCCM as this will automatically give you assess to all the nice MDT scripts including ZTIUtility.vbs ( juts remember to also add your own script!!)

If you do not know how to get the toolkit part to work try and read my blog entry on integrating driverpaths into SCCM http://kongkuba1.spaces.live.com/blog/cns!EEFF1607E296E5AB!212.entry there is a 6 step guide on how to do this towards the top.


Now for the script:


<job id="input">
   <script language="VBScript" src="ZTIUtility.vbs"/>
   <script language="VBScript">

‘//  Global constant and variable declarations

Option Explicit

Dim iRetVal

‘//  End declarations

‘//  Main routine

On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0

‘//  Function:    ZTIProcess()
‘//  Input:    None
‘//  Return:    Success – 0
‘//        Failure – non-zero
‘//  Purpose:    Perform main ZTI processing
Function ZTIProcess()

dim PCname
dim sSysprepInf

PCname=InputBox("Enter PC name:")

sSysprepInf = oEnvironment.Item("DeploySystemDrive") & "sysprepSysprep.inf"

If PCname <> "" then
oUtility.WriteIni sSysprepInf, "Userdata", "ComputerName", PCname
End if

End Function



Copy everything between the === to text File and rename to ***.wsf. That shoud be it.

 Get th escript here:



This entry was posted in SCCM. Bookmark the permalink.

One Response to easy way to change PC name during Deployment

  1. Robin says:

    This is helpful but do you have an example of a script for Vista name changes… Not sure of the required unattended.xml changes required. regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s