修改MDT向导以自动化计算机命名

情况:

我使用MDT Lite-Touch成像新系统。 我正在尝试自定义向导来自动命名新系统,以便在向导页面(例如“FOO”)的下拉框中包含一个前缀“AG-”,一个部门代码,以及最后是成像电脑的序列号,这样我的结果是“AG-FOO-1234567”

状态:

我有一段时间了,但我的谷歌search没有find答案,我的反复试验并没有产生有用的错误信息,我想我错过了一些基本知识,如何从向导页面variables变成lite-touch向导使用的variables。

进展:

  1. 我首先创build了下面将包含的HTML页面,并在页面中添加了一个脚本,将这些脚本连接成一个名为OSDComputername的variables,为了testing,我可以在msgbox中输出并正确显示。
    • 这个问题是我不知道如何触发脚本,然后将其分配给OSDComputernamevariables,该variables在Light-Touch过程的其余部分使用。
  2. 我将脚本更改为一个函数,并将其添加到DeployWiz_Initization.vbs然后使用WDS中的初始化字段来调用它。 我将包括下面的function。
    • 这个问题是我会得到“未定义的variables”为OSDComputername,我不知道它是正确的拉动数据从HTML。
  3. 我尝试在“OSDComputername =”之后将脚本添加到customsettings.ini文件中
    • 这导致向导只是输出我的代码在文本中的计算机名称。
  4. 我尝试在customsettings.ini中添加variables“Properties =”(eg.DepartmentName),从HTML表单中提取值,并将该值设置为DeployWiz_Initization.vbs中的函数中的variables,并在“OSDComputername =”后调用它们customsettings.ini中的时尚“OSDComputername =”AG-“&%DepartmentName%”
    • 这导致了我的脚本中没有正确访问新variables的错误
  5. 我现在有我的代码工作。 它从HTML中提取数据并设置OSDComputername环境variables。 我更新了下面的代码来匹配工作代码。 它是正确的发射和设置我的电脑名称和描述完全符合我的意愿。

问题解决了!

HTML页面:

<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> <FORM NAME="SetComputerNameForm"> <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> <option value="FOO">FOO</option> <option value="DOE">DOE</option> <option value="AFK">AFK</option> <option value="BBL">BBL</option> <option value="RTFM">RTFM</option> </SELECT> </p> <p> <LABEL class="Larger"><u class="Larger">C</u>lient's ID:</LABEL> <br /> <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> </p> <p> <LABEL class="Larger"><u class="Larger">B</u>uilding:</LABEL><br /> <SELECT NAME="Building_Edit" ID="Building_Edit" language=vbscript onpropertychange=ValidateSetComputerName AccessKey=B> <option value="ASA">ASA</option> <option value="ASB">ASB</option> <option value="ASC">ASC</option> </SELECT> </p> <p> <LABEL class="Larger"><u class="Larger">R</u>oom Number:</span></LABEL> <br /> <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> </p> </FORM> 

function:

 Function ValidateSetComputerName ParseAllWarningLabels If Len(Document.SetComputerNameForm.ClientNetID.Value) < 1 OR Len(Document.SetComputerNameForm.RoomNumber.Value) < 1 THEN ButtonNext.disabled = true Else Dim Department Dim SerialNumber Dim CID Dim RoomNumber Dim BuildingName Dim Make Dim Model 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 End If End Function 

问题已解决。 我已经更新了上面的代码以反映我所做的更改。