1

情况:

我正在使用 MDT Lite-Touch 对新系统进行成像。我正在尝试自定义向导以自动命名新系统,以便它们包含前缀“AG-”,这是从向导页面的下拉框中选择的部门代码(例如“COMM”),以及最后是正在成像的计算机的序列号,因此在这种情况下我的结果将是“AG-COMM-1234567”

进步:

  1. 我首先创建了 HTML 页面,我将在下面包含该页面,并在页面中添加了一个脚本以将这些片段连接到一个名为 OSDComputername 的变量中,为了进行测试,我可以在 msgbox 中输出并正确显示。
    • 问题是我不知道如何触发脚本,然后将其分配给整个 Light-Touch 过程的其余部分使用的 OSDComputername 变量。
  2. 我将脚本更改为函数并将其添加到 DeployWiz_Initization.vbs 然后使用 WDS 中的 Initialization 字段来调用它。我将包括下面的功能。
    • 问题是我会得到 OSDComputername 的“未定义变量”,我不确定它是否正确地从 HTML 中提取数据。
  3. 我尝试在“OSDComputername =”之后将脚本添加到 customsettings.ini 文件中
    • 这导致向导仅以文本形式输出我的代码作为计算机名称。
  4. 我现在正在尝试将变量添加到 customsettings.ini 中的“Properties=”(例如DepartmentName),从 HTML 表单中提取它们的值并将该值设置为 DeployWiz_Initization.vbs 中我的函数中的变量,并在“OSDComputername=”之后调用它们" 在 customsettings.ini 中以 "OSDComputername="AG-" & %DepartmentName%" 的方式出现
    • 我现在正在重建,看看情况如何

任何帮助,将不胜感激。

HTML 页面:

<HTML>
<H1>Configure the computer name.</H1>
<span style="width: 95%;">
    <p>Please answer the following questions.  Your answers will be used to formulate the computer's name and description.</p>
        <FORM NAME="TestForm">
            <p>Departmental Prefix: <!-- <label class=ErrMsg id=DepartmentalPrefix_Err>* Required (MISSING)</label> -->
                <SELECT NAME="DepartmentalPrefix_Edit" class=WideEdit>
                    <option value="AADC">AADC</option>
                    <option value="AEM">AEM</option>
                    <option value="AIP">AIP</option>
                    <option value="COM">COM</option>
                    <option value="DO">DO</option>
                    <option value="DSOC">DSOC</option>
                    <option value="EDU">EDU</option>
                    <option value="EPE">EPE</option>
                    <option value="ITN">ITN</option>
                    <option value="LA">LA</option>
                    <option value="OAP">OAP</option>
                    <option value="SML">SML</option>
                    
                </SELECT>
            </p>

            <p><span class="Larger">Client's Net<u class=larger>I</u>D:</span>
            <INPUT NAME="ClientNetID" TYPE="TEXT" ID="ClientNetID" SIZE="15"></p>

            <p>Building: <!-- <label class=ErrMsg id=Building_Err>* Required (MISSING)</label> -->
                <SELECT NAME="Building_Edit" class=WideEdit>
                    <option value="Academic Surge Facility A">Academic Surge Facility A</option>
                    <option value="Academic Surge Facility B">Academic Surge Facility B</option>
                    <option value="Caldwell">Caldwell</option>
                    <option value="Kennedy">Kennedy</option>
                    <option value="Roberts">Roberts</option>
                    <option value="Warren">Warren</option>
                </SELECT>
            </p>

            <p>
                <span class="Larger">Room <u class=larger>N</u>umber:</span>
                <input type=text id="RoomNumber" name=RoomNumber size=15 />
            </p>
        </FORM>           
</span>
</HTML>

功能:

Function SetComputerName

OSDComputerName = "AG-" & oEnvironment.Item("DepartmentalPrefix_Edit")
ComputerDescription = oEnvironment.Item("DepartmentalPrefix_Edit") & ", " & oEnvironment.Item("ClientNetID") & ", " & oEnvironment.Item("RoomNumber") & " " & oEnvironment.Item("Building_Edit")

End Function
4

1 回答 1

1

问题解决了!

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 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

真正的变化在于函数中我需要如何从我的自定义 HTML 屏幕中检索值。您将在工作函数中看到我必须使用以下格式设置每个值:Document.FormName.FieldName.Value

I could then use the built-in Environmental Items to collect the Make, Model, and Serial Number. Once I had all of the pieces, all of the user selections and built-in values, it was simply a matter of concatenating the strings in the order I wanted and assigning the value to the Environmental Items "OSDComputerName" and "ComputerDescription".

I also made use of ButtonNext.disabled to make all of the fields required before the user was able to continue to the next screen.

于 2012-10-09T12:54:14.577 回答