Creating Simple and/or Smart Custom Wizard Panes (Prompts) for MDT using the Wizard Editor.

By Brian GonzalezNo Comments

Using the Wizard Editor is fairly self explanatory for adding simple wizard panes. In 90%+ deployment scenarios, a simple wizard pane including a couple of radio buttons suffice.

Here is a simple “Department Name” Wizard Pane, which include 2 radio buttons; “IT Department” and “Sales”. After the Wizard is answered, a “DepartmentName” variable is created and populated with either “ITDEPT” or “SALES” based on the wizard selection:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<H1>Choose the User Department.</H1>
<table>
 <tr>
   <td><input type=radio name="DepartmentName"
   id="DTRadio1" checked value="SALES" accesskey=s language=vbscript />
   <label class=Larger for=DTRadio1 language=vbscript >
   <u class=larger>S</u>ales Department.</label></td>
 </tr>
 <tr></tr>
 <tr>
   <td><input type=radio name="DepartmentName"
   id="DTRadio2" value="ITDEPT" accesskey=u language=vbscript />
   <label class=Larger for=DTRadio2 language=vbscript >
   <u class=larger>I</u>T Department.</label></td>
 </tr>
</table>

Department Name Wizard

Now lets create a more advanced prompt for that 10% of times when radios are not enough. This prompt will ask for a string named “NewUserName”. It will verify that the string entered is 10 characters in length and only contains letters.

1
2
3
4
5
6
7
8
9
10
11
12
<H1>Please enter the System's New UserName.</H1>
 <span style="width: 95%;">
 <span class="Larger"><u class=larger>U</u>ser Name:</span>
   <input type=text id="NewUserName" name=NewUserName maxlength=10
   size=10 language=vbscript onpropertychange=ValidateNewUserName
   AccessKey=U />
   <p>&nbsp;
     <label class=ErrMsg for=NewUserName>Answer is Required..</label>
     <label class=ErrMsg id=InvalidChar>Letters only!</label>
     <label class=ErrMsg id=TooShort>Answer must be 10 characters!</label>
   </p>
 </span>

Now you must add Functions to the “\Scripts\DeployWiz_Validation.vbs” script to support the Function call (ValidateNewUserName) which performs the string validation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'''''''''''''''''''''''''''''''''''''
'  Validate NewUserName
'

Function ValidateNewUserName
 
	' Check Warnings
	ParseAllWarningLabels
 
	If Len( NewUserName.value ) < 10 then
		InvalidChar.style.display = "none"
		TooShort.style.display = "inline"
		ValidateNewUserName = false
		ButtonNext.disabled = true
	ElseIf IsValidNewUserName ( NewUserName.Value ) then
		ValidateNewUserName = true
		InvalidChar.style.display = "none"
		TooShort.style.display = "none"
	Else
		InvalidChar.style.display = "inline"
		TooShort.style.display = "none"
		ValidateNewUserName = false
		ButtonNext.disabled = true
	End if
 
End function
 
Function IsValidNewUserName( NewUserName )
 
	const IVNAME_TEST = "[a-z]{10}"
	Dim regEx, match, myMatches
 
	Set regEx = New RegExp
	regEx.Pattern = IVNAME_TEST
	regex.IgnoreCase = true
 
	Set myMatches = regEx.Execute( UCase(NewUserName) )
	If myMatches.Count > 0 Then
		IsValidNewUserName = true
	End If
End function

New User Name Wizard Pane

Only Letters Error

For building custom RegEx expressions, I suggest using RegExBuddy for Windows users and Kodos for Linux users.

-Brian G

Share
MDT, Scripting, Uncategorized

Leave your Comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Blue Taste Theme created by Jabox