Adding the NIC Settings Dialog

Oct 22, 2009 at 5:30 PM

Can anyone assist me with adding the NIC Settings dialog after the Computername Dialog?

In the DeployWiz_Definition_ENU.xml I have added:

Initialization: ZTINicUtility.vbs

Then I created a new Pane called NetworkSettings and Added the following:

Initialization: InitializeNetworkDialog
Validation: ValidateNetworkDialog
CustomSettings:

   document.title =  "Deployment Wizard"
  window.resizeTo 700,500

  CleanNetworkSettings 0
  oProperties.RemoveAll
  
  Function InitializeNetworkDialog
  
   Dim oItem
   Dim i

   i = 0
   For Each oItem in ObjNetworkAdapters
    If not oProperties.Exists("OSDAdapter" & i & "Description") then
     oProperties.Add "OSDAdapter" & i & "Description", oItem.Description
     oProperties.Add "OSDAdapter" & i & "MacAddress", join(ostrings.ForceAsArray( oItem.MACAddress, empty ),",")
     If oItem.DHCPEnabled then
      oProperties.Add "OSDAdapter" & i & "DHCP","True"
     Else
      oProperties.Add "OSDAdapter" & i & "DHCP","False"
      
      on error resume next
      oProperties.Add "OSDAdapter" & i & "IPAddressList", join(ostrings.ForceAsArray( oItem.IPAddress, empty ),",")
      oProperties.Add "OSDAdapter" & i & "SubnetMask", join(ostrings.ForceAsArray( oItem.IPSubnet, empty ),",")
      oProperties.Add "OSDAdapter" & i & "Gateways", join(ostrings.ForceAsArray( oItem.DefaultIPGateway, empty ),",")
      oProperties.Add "OSDAdapter" & i & "DNSServerList", join(ostrings.ForceAsArray( oItem.DNSServerSearchOrder, empty ),",")
      oProperties.Add "OSDAdapter" & i & "DNSSuffix", oItem.DNSDomain
      oProperties.Add "OSDAdapter" & i & "WINSServerList", oItem.WINSPrimaryServer & "," & oItem.WINSSecondaryServer
      on error goto 0

     End if

     i = i + 1
     OSDAdapterCount.value = i
    End if
   Next
   
   EnumChkAll
   PopulateElements

  End Function
  
  Function EnumChkAll
   Dim i,j
   Dim DisableMain
   
   for i = 0 to 5
    If i > OSDAdapterCount.value -1 then

     ' Disable and Hide
     document.GetElementByID("OSDAdapter" & i & "DHCP").disabled = true
     document.GetElementByID("OSDAdapter" & i & "Display").style.display = "none"
     DisableMain = True

    Else

     document.GetElementByID("OSDAdapter" & i & "Display").style.display = "inline"
     document.GetElementByID("OSDAdapter" & i & "DHCP").disabled = False
     DisableMain = cbool(document.GetElementByID("OSDAdapter" & i & "DHCP").Checked)

    End if

    for each j in array("IPAddressList","SubnetMask","Gateways","DNSServerList","DNSSuffix","WINSServerList")
     document.GetElementByID("OSDAdapter" & i & j ).Disabled   = DisableMain
    next

   next
   
   ParseAllWarningLabels
  
  End function

  Function ValidateNetworkDialog
  
   Dim sErrorMsg
   Dim oItem
   Dim i,j
   Dim bDirty
   
   ' Possible that the user didn't mean to select this dialog.
   bDirty = false
   for i = 0 to (OSDAdapterCount.value -1)
    If not cbool(document.GetElementByID("OSDAdapter" & i & "DHCP").Checked) then
     bDirty = true
     exit for
    End if
   next
   If not bDirty then
    oLogging.CreateEntry "Welcome NIC Settings, Early Exit." , LogTypeInfo
    window.close
   End if


   for i = 0 to (OSDAdapterCount.value -1)
    
    If cbool(document.GetElementByID("OSDAdapter" & i & "DHCP").Checked) then

     oLogging.CreateEntry "Clear out settings. OSDAdapter" & i & "MacAddress = " & document.GetElementByID("OSDAdapter" & i & "MacAddress" ).Value, LogTypeInfo
     for each j in array("IPAddressList","SubnetMask","Gateways","DNSServerList","DNSSuffix","WINSServerList")
      oEnvironment.Item("OSDAdapter" & i & j )  = ""
     next
     oEnvironment.Item("OSDAdapter" & i & "MacAddress" )  = "<DHCP>"

    Else
    
     for each j in array("MacAddress","IPAddressList","SubnetMask","Gateways","DNSServerList","DNSSuffix","WINSServerList")
      oEnvironment.Item("OSDAdapter" & i & j )  = document.GetElementByID("OSDAdapter" & i & j ).Value
     next
     
    End if
    
   next

   oEnvironment.Item("OSDAdapterCount") = OSDAdapterCount.Value
   
   ' Load the settings into the device via WMI
   i = 0
   For each oItem in ObjNetworkAdapters

    If cbool(document.GetElementByID("OSDAdapter" & i & "DHCP").Checked) = False then
     sErrorMsg = LoadNetworkAdapterSettings ( oItem, i )
    End if
    i = i + 1

   Next

   if sErrorMsg <> "" then
    Dim sNicMessage
    sNicMessage = "Network settings have been applied except for the following:" & vbNewLine & vbNewLine
    sNicMessage = sNicMessage & sErrorMsg & vbNewLine & vbNewLine & "OK to Continue?"
    if MsgBox (sNicMessage, vbYesNo, "Networking Settings Error" ) <> vbYes then
     ValidateNetworkDialog = FALSE
     exit function
    end if
   end if

   ' We are done. Settings have been saved. Hard Exit!
   window.close

  end function

  

CustomHTML:

   <H1>Configure Static IP Network Settings<H1>

   <span id=OSDAdapter0Display >
    <table width=95% id=OSDAdapter0>

     <tr>
      <td>
      <input type=checkbox id=OSDAdapter0DHCP checked value="False" onclick=EnumChkAll language="vbscript"/>
      </td>
      <td colspan=2>
      <label for=OSDAdapter0DHCP />Enable DHCP</label>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input disabled type=text id=OSDAdapter0Description name="OSDAdapter0Description" size=50 value="0" />
      
      </td>
     </tr>

     <tr>
      <td></td>
      <td width=25%>Physical (MAC) Address:</td>
      <td  width=70%>
      <input disabled type=text id=OSDAdapter0MacAddress name="OSDAdapter0MacAddress" size=30 title="Read Only" />
      </td>
     </tr>

     <tr>
      <td></td>
      <td>IP Address(es): </td>
      <td>
      <input disabled type=text id=OSDAdapter0IPAddressList name="OSDAdapter0IPAddressList" size=30
       title="IP Address (Comma Delimited). Example: [192.168.1.50,192.168.100.52] " /> *
      <label for=OSDAdapter0IPAddressList>* Required (MISSING)</label>
      </td>
     </tr>

     <tr>
      <td></td>
      <td>Subnet Mask(s): </td>
      <td>
      <input disabled type=text id=OSDAdapter0SubnetMask name="OSDAdapter0SubnetMask" size=30 
       title="IP Address (Comma Delimited). Example: [255.255.255.0,255.255.255.0] "/> *
      <label for=OSDAdapter0SubnetMask>* Required (MISSING)</label>
      </td>
     </tr>

     <tr>
      <td></td>
      <td>Default Gateway(s):</td>
      <td>
      <input type=text id=OSDAdapter0Gateways name="OSDAdapter0Gateways" size=30  
       title="Default Gateway (Comma Delimited). Example: [192.168.1.1,192.168.100.1] " /> *
      </td>
     </tr>

     <tr>
      <td></td>
      <td>DNS Server(s):</td>
      <td>
      <input type=text id=OSDAdapter0DNSServerList name="OSDAdapter0DNSServerList" size=30  
       title="DNS Server List (Comma Delimited). Example: [192.168.1.10,192.168.100.11]" /> *
      </td>
     </tr>

     <tr>
      <td></td>
      <td>DNS Suffixes:</td>
      <td>
      <input type=text id=OSDAdapter0DNSSuffix name="OSDAdapter0DNSSuffix" size=30 value=""
       title="DNS Suffix (Comma Delimited). Example: [fabrikam.com]"/>
      </td>
     </tr>

     <tr>
      <td></td>
      <td>WINS Server(s):</td>
      <td>
      <input type=text id=OSDAdapter0WINSServerList name="OSDAdapter0WINSServerList" size=30 
       title="Wins Server List (Comma Delimited). Example: [192.168.1.10,192.168.100.11] " /> *
      </td>
     </tr>
     
     <tr>
     <td colspan=3>&nbsp;</td>
     </tr>
     
    </table>
   </span>
   

   <input type=hidden name="OSDAdapterCount" value="1" />