Monday, 19 April 2010

Script to alter Computername in a SCCM Task Sequence.

If you need to change the name of a computer based on a pre-configured variable, this should help you to accomplish the task.

Download script from SkyDrive

To use the script, simply run it from a SCCM Task Sequence (Run Command Line f.ex) with the following string:
Cscript "pathtoscript"\NewComputerName.vbs /N:%VariableName%

If you wish to query the user for input, I suggest using OSD++, if you run OSD++ with the following XML,
the user can input a computer name and the input is stored in a SCCM Task Sequence called NewComputerName.


To use this input with the script, run the script with this string:
Cscript "pathtoscript"\NewComputerName.vbs /N:%NewComputerName%

Side note:
You can actually set the OSDComputerName Variable right in OSD++,
the reason I'm not doing so will become clear in a later post that is under construction.
-Alex

3 comments:

  1. I have tried to add this logic to a "Install OS" task sequence.

    I've put OSDplusplus.exe in commandline task followed immediately by "cscript..." etc - These are both in the "Setup Operating System" section.

    While I get prompted for the computer name, the vbScript isn't actually doing the re-naming...

    What am I missing? Do I need to be placing these earlier in the task sequence?

    ReplyDelete
  2. The variable must be placed prior to the OSD being deployed as it changes the unattended information that SCCM uses

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete