Jump to content


Sign in to follow this  
ThinkRSX

Prestart Customization

Recommended Posts

This is my first time posting, however, I've spent a lot of time reading the vast amounts of knowledge on this site.

 

I'm relatively new to OSD through SCCM, however, I've spent the past month reading and testing so that I can implement the technology for my employer.

 

I have my CM12 w/MDT 2013 integrated task sequence setup and working well. In it's current form, there are two Collection Variables assigned to the "Unknown Computers" collection. The variables are "OSDComputerName" and "languageValue".

 

What I was hoping to do was eliminate the need for those Collection Variables by enabling the Prestart command and calling ZTIMediahook.wsf in my MDT Boot Disk. Out of the box, this gives you a prompt for OSDComputername, now all I need to do is add a dropdown box containing my languages.

 

I've multiple attempts at trying to achieve this. I've tried modifying Wizard.hta with PrimalScript and the MDT Wizard Studio but had no success. Since I'm not very strong in writing script, I've borrowed code from the various FrontEnds out and tools like the HTA Helpomatic tried plugging them in.

 

Hopefully someone out there can assist me with this. I need to modify Wizard.hta to add a dropdown list, preferably on the same page as Computer Name, which lists "English, French, Spanish, Multi" and sets the custom "languageValue" variable equal to that box.

 

Any assistace would be greatly appreciated. Thanks!

Share this post


Link to post
Share on other sites


I think I've almost gotten it. Still getting an "Error 1024 = Expected Statement.

 

Here's the VBS

Option Explicit


'''''''''''''''''''''''''''''''''''''
'  Initialize ComputerName
'

Function InitializeComputerName

	If oUtility.ComputerName = "" Then
				
		If oEnvironment.Item("HostName") <> "" Then
			OSDComputerName.Value = oEnvironment.Item("HostName")
		Else
			OSDComputerName.Value = oENV("ComputerName")
		End If

	Else
		OSDComputerName.Value = oEnvironment.Item("OSDComputerName")
	End If

End Function


'''''''''''''''''''''''''''''''''''''
'  Validate ComputerName
'

Function ValidateComputerName

	' Check Warnings
	ParseAllWarningLabels


	If Len(OSDComputerName.value) > 15 then
		InvalidChar.style.display = "none"
		TooLong.style.display = "inline"
		ValidateComputerName = false
		ButtonNext.disabled = true
	ElseIf IsValidComputerName ( OSDComputerName.Value ) then
		ValidateComputerName = TRUE
		InvalidChar.style.display = "none"
		TooLong.style.display = "none"
	Else
		InvalidChar.style.display = "inline"
		TooLong.style.display = "none"
		ValidateComputerName = false
		ButtonNext.disabled = true
	End if

End Function

'''''''''''''''''''''''''''''''''''''
'  Initialize LanguageValue
'

Function InitializeLanguageValue

For Each oSelection in languageValue.Options
        If oSelection.Selected Then
            oEnvironment("languageValue") = oSelection.id
        End If

End Function

And the HTML:

<Wizard>
  <Global>
  </Global>
  <Pane id="ComputerName" title="Computer Name">
    <Body><![CDATA[

    <H1>Configure the computer name.</H1>
    <span style="width: 95%;">

        <p>Choose a name for your PC that will help you identify it on your network, if you have one. Each computer on your network must have a unique name.</p>
        <P>You can name your computer based on its owner or location, for example "DAVID" or "XYZLAB123." In order
        for your computer to appear on a network, its name cannot be longer than 15 characters or contain any
        spaces or characters aside from the numbers 0-9, the letters A-Z and a-z, and hyphens.</P>

        <p><span class="Larger">Computer n<u class=larger>a</u>me:</span>
        <input type=text id="OSDComputerName" name=OSDComputerName size=15 language=vbscript onpropertychange=ValidateComputerName AccessKey=A /></p>

        <p> 
          <label class=ErrMsg for=OSDComputerName>* Required (MISSING)</label>
          <label class=ErrMsg id=InvalidChar>Letters, Numbers & Dashes only!</label>
          <label class=ErrMsg id=TooLong>Maximum of 15 characters!</label>
        </p>
		
		<H1>Select a language</H1>
    <span style="width: 95%;">
        <p>Select a primary language.</p>
				<select size="1" id="languageValue" name=languageValue onChange="RunScript">
				<option value="1" id="English">English</option>
				<option value="2" id="French">French</option>
				<option value="3" id="Spanish">Spanish</option>
				</select>
				
        <!--  Computer Description Format -->
        <!--

        <p>You can also give your computer a friendly description. Unlike the computer
        name, the computer description may contain spaces and other special characters. "Frank Kim's Test machine" and
        "E-Mail Server #23, Miami Regional Office, Rm. 2305." are examples of computer descriptions.</p>

        <p><span class="Larger">Computer <u class=larger>d</u>escription:</span><br/>
        <input type=text id="Description" name=ComputerDescription size=60 language=vbscript onpropertychange=ValidateComputerName AccessKey=d /></p>
        -->

    </span>

		]]></Body>
    <Condition><![CDATA[UCase(Property("SkipComputerName"))<>"YES" and Property("DeploymentType")<>"REPLACE" and Property("DeploymentType")<>"CUSTOM" ]]></Condition>
    <Initialization><![CDATA[InitializeComputerName]]></Initialization>
    <Validation><![CDATA[ValidateComputerName]]></Validation>
  </Pane>
</Wizard>

Share this post


Link to post
Share on other sites

I was able to resolve the issue by placing the Language Value drop down on a separate page (may not have been necessary) and removing the "onChange="RunScript" from the drop down box HTML. I must have missed this when I borrowed it from the HTA Helpomatic tool.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...