Tuesday, July 30, 2013

Prompt for computer name using SCCM OSD

Recently I helped one of the project team to automate server builds.
As part of the automation, I have asked to create a deploy task sequence with a computer name prompt so the technician can enter the unique names based on the server type and location.

So the requirements are;
Name prompt
            Name validation for uppercase only

First, I thought I will go with HTA and VBScript, and then decided to go with OSD PlusPlus as I am already using OSDPlusPlus for other things.

1.       Downloaded OSDPlusPlus from http://myitforum.com/cs2/blogs/jsandys/pages/osdplusplus.aspx
2.       Created an XML file as below; (Name.xml)

<?xml version="1.0" encoding="utf-8"?>

<GetReg hive="HKLM" key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" value="CurrentVersion" varname="CurrentVersion" />
<GetWmi namespace="root\cimv2" class="Win32_ComputerSystem" property="model" varname="csmodel" />

<GetUser title="Venu Singireddy Lab" subtitle="Please choose one from below" icon="64">

<Textbox prompt="Server Name" regex="^[^a-z\s._-]+$" varname="ServerName" icon="45" helptxt="Please use uppercase letters and numbers"/>
<PutTSVar varname="ServerName" tsvar="OSDName"/>


3.  Create a package using OSDPlusPlus.exe and XML file
4.  Add to the Task Sequence as below.
4.1               After the Disk partition, create a “Run Command line” Step and rename to PC Name prompt. Add OSDPlusPlus64.exe /Conf:Name.xml
4.2     Tick Disable 64-bit file system redirection
4.3     Select package which you have created in step 3
5.  Above steps will prompt for a computer name and validates given name to only for uppercase letters and numbers then sets the given name as OSDName.
Task sequence will use the OSDName variable to join the domain or that will be the computer name.

No comments:

Post a Comment