Thursday, October 04, 2012 6:32 PMSituation:
I am imaging new systems using MDT Lite-Touch. I am trying to customize the wizard to automate the naming of new systems so that they include a prefix "AG-", a department code which is selected from a drop-down box in the wizard page (eg. "COMM"), and finally the serial number of the computer being imaged, so that my result in this case would be "AG-COMM-1234567"
I have banged away at this for a while but my Google searches have not turned up answers, my trial-and-error is not producing useful error messages and I think I am missing some fundamentals of how to get variables from the wizard page into the variables used by the lite-touch wizard.
1. I first created the HTML page which I will include below and added a script to the page to concatenate the pieces into a variable called OSDComputername which, for testing, I could output in a msgbox and get to display correctly.
* The problem with this is I don't know how to trigger the script then assign it to the OSDComputername variable that is used throughout the rest of the Light-Touch process.
2. I changed the script to a function and added it to DeployWiz_Initization.vbs then used the Initialization field in WDS to call it. I'll include the function below.
* The problem with this is I would get "Undefined Variable" for OSDComputername and I am not sure it is pulling the data from the HTML correctly.
3 . I tried adding variables to "Properties=" (eg.DepartmentName) in the customsettings.ini, pulling thier value from the HTML Form and setting that value to the variable in my function in DeployWiz_Initization.vbs and calling them after "OSDComputername=" in the fashion "OSDComputername="AG-" & %DepartmentName%" in customsettings.ini
* This resulted in errors from my script which did not correctly access the new variables
4. I now have my code working. It is pulling the data from the HTML and setting the OSDComputername environment variable. I have updated the code below to match the working code. It is firing correctly and setting my computer name and description exactly as I wanted it to.
* Issue Resolved!
The HTML page:
<H1>Configure the computer name.</H1>
<p>Please answer the following questions. Your answers will be used to formulate the computer's name and description.</p>
<LABEL class="Larger"><u class="Larger">D</u>epartmental Prefix:</LABEL><br />
<SELECT NAME="DepartmentalPrefix_Edit" ID="DepartmentalPrefix_Edit" language=vbscript onpropertychange=ValidateSetComputerName AccessKey=D>
<LABEL class="Larger"><u class="Larger">C</u>lient's ID:</LABEL>
<INPUT NAME="ClientID" ID="ClientID" TYPE="text" ID="ClientID" SIZE="15" language=vbscript onpropertychange=ValidateSetComputerName AccessKey=C />
<label class=ErrMsg for=ClientID>* Required (MISSING)</label>
<LABEL class="Larger"><u class="Larger">B</u>uilding:</LABEL><br />
<SELECT NAME="Building_Edit" ID="Building_Edit" language=vbscript onpropertychange=ValidateSetComputerName AccessKey=B>
<LABEL class="Larger"><u class="Larger">R</u>oom Number:</span></LABEL>
<INPUT NAME="RoomNumber" ID="RoomNumber" TYPE="text" ID="RoomNumber" size="15" language=vbscript onpropertychange=ValidateSetComputerName AccessKey=R>
<label class=ErrMsg for=RoomNumber>* Required (MISSING)</label>
If Len(Document.SetComputerNameForm.ClientNetID.Value) < 1 OR Len(Document.SetComputerNameForm.RoomNumber.Value) < 1 THEN
ButtonNext.disabled = true
Department = Document.SetComputerNameForm.DepartmentalPrefix_Edit.Value
SerialNumber = oEnvironment.Item("SerialNumber")
CID = Document.SetComputerNameForm.ClientID.Value
RoomNumber = Document.SetComputerNameForm.RoomNumber.Value
BuildingName = Document.SetComputerNameForm.Building_Edit.Value
Make = oEnvironment.Item("Make")
Model = oEnvironment.Item("Model")
oEnvironment.Item("OSDComputerName") = "AG-" & Department & "-" & Right(SerialNumber,7)
oEnvironment.Item("ComputerDescription") = Department & ", " & CID & ", " & RoomNumber & " " & BuildingName & ", " & Make & " " & Model
ButtonNext.disabled = false
Thursday, October 04, 2012 10:54 PM
There's a tool to do this for you. It's the MDT Wizard Editor.
It's here on the blog of the MDT developer: http://blogs.technet.com/b/mniehaus/archive/2012/03/01/3474394.aspx
Friday, October 05, 2012 12:37 PMYeah, I have the MDT Wizard Editor, my HTML loads in the wizard and my code seems to be pulling data and setting the appropriate environment variables, but it it pulls the information before the user has made entries on the web page. So, I get the information as it stands when the page first loads. I guess I am close now, but I need the script to fire after the user has entered all their data. I was thinking the optimal way of handling it would be to tie the script to the 'Next' button in the wizard, but I don't see a way to do this.
Tuesday, October 09, 2012 1:21 PMIssue is resolved. It is working exactly as I wanted now. I have updated the code and notes above to reflect the changes I made.
- Marked As Answer by JeramyAK Tuesday, October 09, 2012 1:21 PM