I’m trying to add a panel to the wizard that lets me select a computer role to deploy. I’ve added the panel and it loads, but does not load any data.
I’m fairly new to MDT and followed guides I found online to help me accomplish this.
The MDT server is currently just my workstation, as we are still testing. It’s also running SQLEXPRESS on it so I can use the database features.
Here is some relevant config files to help get an idea of what’s going on.
ScriptsDeployWiz_Definition_ENU.xml
<Pane id="DeploymentRole" reference="DeployWiz_DeploymentRole.xml">
<Condition><![CDATA[UCase(Property("SkipDeploymentRole"))<>"YES" ]]></Condition>
</Pane>
ScriptsDeployWiz_DeploymentRole.vbs
Function InitializeRoleList
Dim oSelRole
Dim sFilteredXML
Dim sCmd
Dim iRetVal
If oEnvironment.listitem("SelectableRole") is nothing then
Exit function
ElseIf oEnvironment.listitem("SelectableRole").count < 1 Then
Exit function
End if
For each oSelRole in Property("SelectableRole")
sFilteredXML = sFilteredXML & "<Selectablerole>"
sFilteredXML = sFilteredXML & "<role>"
sFilteredXML = sFilteredXML & oSelRole
sFilteredXML = sFilteredXML & "</role>"
sFilteredXML = sFilteredXML & "<comments>"
sFilteredXML = sFilteredXML & "</comments>"
sFilteredXML = sFilteredXML & "</Selectablerole>"
Next
If not IsEmpty(sFilteredXML) then
broles.XMLDocument.LoadXML "<SelectableRoles>" & sFilteredXML & "</SelectableRoles>"
End if
End Function
Function ReadyInitializeRoleList
Dim oInput, oSelectableRoleList
Dim bFound, oRoleItem
ButtonNext.Disabled = False
If not bRoleList.readystate = "complete" then
Exit function
End if
Set oSelectableRoleList = document.getElementsByName("Role")
If oSelectableRoleList is nothing then
Exit function
ElseIf oSelectableRoleList.Length < 1 then
Exit function
End if
For each oInput in oSelectableRoleList
If UCase(document.all.item(oInput.SourceIndex - 1).TagName) = "INPUT" then
If oInput.Value = "" then
document.all.item(oInput.SourceIndex - 1).Disabled = TRUE
document.all.item(oInput.SourceIndex - 1).Style.Display = "none"
Else
document.all.item(oInput.SourceIndex - 1).Style.Display = "inline"
If not IsEmpty(Property("Role"))then
For each oRoleItem in Property("Role")
If UCase(oRoleItem) = UCase(oInput.Value) then
document.all.item(oInput.SourceIndex - 1).checked = TRUE
document.all.item(oInput.SourceIndex - 1).disabled = TRUE
Exit for
End if
Next
End if
End if
End if
Next
End function
Sub RoleItemChange
document.all.item(window.event.srcElement.SourceIndex + 1).Disabled = not window.event.SrcElement.checked
End Sub
Function ValidateRoleList
dim oRoleList, oSelectedRoleList
dim oRole, oSelectedRole
dim objTmp, i, bFound
Dim iRetVal, sCmd
' Retrieve any current roles assigned to this machine
Set objTmp = oEnvironment.ListItem("Role")
' Retrieve the roles displayed on the wizard
Set oRoleList = document.getElementsByName("Role")
Set oSelectedRoleList = document.getElementsByName("SelectedItem")
' Exit if the wizard did not have any roles
If oSelectedRoleList is nothing then
ValidateRoleList=True
Exit function
ElseIf oSelectedRoleList.Length < 1 then
ValidateRoleList=True
Exit function
End if
bFound = False
' Loop through all roles that where checked
For i= 0 to oRoleList.length -1
If oSelectedRoleList(i).checked then
If not objTmp.Exists(oRoleList(i).value) Then
objTmp.Add oRoleList(i).value, "" ' Adding additional role to list
bFound = True
End If
End If
Next
' Only update roles if there was a new role checked
If bFound Then
' Set the role property back using the additional deployment roles that were checked
Set oEnvironment.ListItem("Role") = objTmp
End If
ValidateRoleList = True
End Function
ScriptsDeployWiz_DeploymentRole.xml
(both prettified and cdata included. The pane did not load without wrapping the body in CDATA)
<?xml version="1.0" encoding="utf-8" ?>
<Wizard>
<Global>
<CustomScript>DeployWiz_DeploymentRole.vbs</CustomScript>
</Global>
<!--
<H1>Select an image role to apply.</H1>
<p>The following roles are available for your computer.</p>
<div class=DynamicListBox style="height: expression( GetDynamicListBoxSize(this) ); ">
<table id="bRoleList" datasrc="#broles" width="100%" border=0 cellSpacing=0 language=vbscript onreadystatechange=ReadyInitializeRoleList>
<tr valign=top class="DynamicListBoxRow" onmouseover="javascript:this.className = 'DynamicListBoxRow-over';" onmouseout="javascript:this.className = 'DynamicListBoxRow';" >
<td class=DynamicListBoxElement width="0px">
<input type=checkbox name=SelectedItem language=vbscript onPropertyChange="RoleItemChange" />
<input type=hidden Name=Role disabled datafld="Role" />
</td>
<td language=vbscript onclick="ClickChildCheckBox" class=DynamicListBoxElement width="100%">
<div><Label name=Role datafld="Role" class="Larger" ></Label></div>
<div>
<Label datafld="comments" dataformatas="HTML">
<label class=errmsg style="display: inline;" >No roles are available (selectableRoles view)</label>
</Label>
</div>
</td>
</tr>
</table>
<label id=ProcessRoleProperties class=ErrMsg>Processing Role properties...</label>
</div>
<xml id="broles"></xml>
-->
<Pane id="DeploymentRole" title="Deployment Role">
<Body>
<![CDATA[ <H1>Select an image role to apply.</H1> <p>The following roles are available for your computer.</p><div class=DynamicListBox style="height: expression( GetDynamicListBoxSize(this) ); "><table id="bRoleList" datasrc="#broles" width="100%" border=0 cellSpacing=0 language=vbscript onreadystatechange=ReadyInitializeRoleList><tr valign=top class="DynamicListBoxRow" onmouseover="javascript:this.className = 'DynamicListBoxRow-over';" onmouseout="javascript:this.className = 'DynamicListBoxRow';" ><td class=DynamicListBoxElement width="0px"> <input type=checkbox name=SelectedItem language=vbscript onPropertyChange="RoleItemChange" /><input type=hidden Name=Role disabled datafld="Role" /> </td><td language=vbscript onclick="ClickChildCheckBox" class=DynamicListBoxElement width="100%"><div><Label name=Role datafld="Role" class="Larger" ></Label></div> <div><Label datafld="comments" dataformatas="HTML"><label class=errmsg style="display: inline;" >No roles are available (selectableRoles view)</label></Label></div></td></tr></table><label id=ProcessRoleProperties class=ErrMsg>Processing Role properties...</label></div><xml id="broles"></xml>]]>
</Body>
<Initialization>
<![CDATA[ InitializeRoleList ]]>
</Initialization>
<Validation>
<![CDATA[ ValidateRoleList ]]>
</Validation>
</Pane>
</Wizard>
ControlDeploymentRole.ini
[Settings]
Priority=RoleApps, RoleAdmins, RoleSettings
Properties=
[RoleApps]
SQLServer=MDTTESTSVR
Instance=SQLEXPRESS
Database=mdt
;Can be either Named Pipes (DBNDPNTW) or TCP/IP Sockets (DBMSSOCN).
Netlib=DBMSSOCN
SQLShare=Client
Table=RoleApplications
Parameters=Role
Order=Sequence
[RoleAdmins]
SQLServer=MDTTESTSVR
Instance=SQLEXPRESS
Database=mdt
;Can be either Named Pipes (DBNDPNTW) or TCP/IP Sockets (DBMSSOCN).
Netlib=DBMSSOCN
SQLShare=Client
Table=RoleAdministrators
Parameters=Role
[RoleSettings]
SQLServer=MDTTESTSVR
Instance=SQLEXPRESS
Database=mdt
;Can be either Named Pipes (DBNDPNTW) or TCP/IP Sockets (DBMSSOCN).
Netlib=DBMSSOCN
SQLShare=Client
Table=RoleSettings
Parameters=Role
Deployment Share Rules (snippet)
[Settings]
Priority=Default,SetShowRole,SelectableRoles
Properties=SkipDeploymentRole,ShowRole,SelectableRole(*)
[SetShowRole]
ShowRole=1
[SelectableRoles]
SQLServer=MDTTESTSVR
Database=mdt
Netlib=DBMSSOCN
Instance=SQLEXPRESS
Table=SelectableRoles
Parameters=ShowRole
SQLShare=Client
[Default]
SLShare=\MDTTESTSVRmdtlogs