Custom MDT Wizard For Network Settings

by Jeremy Saunders on January 4, 2015

Setting a fixed IP Address during the MDT task sequences has always been ugly. It’s an area that I believe needs to be revisited by Microsoft.

  • I don’t like the concept behind the “Apply Network Settings” task action. I don’t find it dynamic enough. In my opinion it’s too cumbersome and involved.
  • The old “NICSettings_Definition_ENU.xml” custom pane no longer works from MDT 2012 and above as pointed out by a commenter on Michael Niehaus article about Customizing Wizards with MDT 2012.
  • I don’t like the way the ZTINicUtility.vbs and ZTINICConfig.wsf scripts have been constructed. Too messy and too hard to follow. I appreciate that these have ended up the way they are over time, but a fresh start would be my recommendation.

I just found that everything out of the box was too messy and static. There are a couple of different blogs by others on this, but they also seemed quite awkward.

Of course if you’re looking to automate as much as possible, which is what I strive for, then some back-end apps require a fixed/static IP address set before they’re installed. Sure you can reserve addresses in DHCP, but that’s a management touch point I wanted to avoid. I prefer to allocate in the design and build out based on that.

I wanted something slick and simple so I created my own.

The following screen shot is what the wizard first looks like when launched.

MDT Custom Wizard-Network Adapter Configuration-DHCP

The cool thing here is that when you select the “Use Static IP Settings” radio button, it automatically populates the required fields from the current adapter settings. This assists the person initiating the deployment because all they typically need to do is change the IP Address.

MDT Custom Wizard-Network Adapter Configuration-Static

As you can see this version of the script allows you to set 4 values:

  • IP Address
  • Subnet Mask
  • Default Gateway
  • DNS Server Search Order

Regardless of whether or not you select DHCP or Static IP the script is hard coded to:

  • Disable NetBIOS over TCP/IP, which in this day and age should be a best practice. It should also be the Operating System default. Are you listening Microsoft?
  • Enable the “Register this connection’s address in DNS”, which is default.
  • Disable the “Use this connection’s addresses in DNS”, which is default.

I’m actually reusing 6 existing task sequence variables and creating 1 new one:

  • OSDAdapterCount
  • OSDAdapter0EnableDHCP
  • OSDAdapter0IPAddressList
  • OSDAdapter0SubnetMask
  • OSDAdapter0Gateways
  • OSDAdapter0DNSServerList
  • SkipNetworkSettings

So to implement it simply download the following 3 files, remove the “_.txt” extension, and place them in the %SCRIPTROOT% (Scripts) folder of your deployment share.

Edit the “DeployWiz_Definition_ENU.xml” and add the following lines after the DeployWiz_ComputerName.xml pane has been added.

<Pane id="NICSettings" reference="DeployWiz_NICSettings.xml">
<Condition><![CDATA[UCASE(Property("SkipNetworkSettings"))<>"YES" ]]></Condition>

The condition means that the pane will not show if the SkipNetworkSettings is set to YES. Hence the new variable.

So now we modify the CustomSettings.ini

; Add SkipNetworkSettings as a new property

; NIC Settings
; If you set SkipNetworkSettings to YES, either remove/disable the Set-IPV4Address.ps1 PowerShell
; script from/in the Task Sequence or set the OSDAdapterCount=1 and OSDAdapter0EnableDHCP=TRUE in
; the CustomerSettings.ini. This ensures these are no errors during the build process.

All that’s left to do is to add a “Run PowerShell Script” action to run the “%SCRIPTROOT%\Set-IPV4Address.ps1” PowerShell script. You can place this action where ever you think it’s appropriate in your sequence. The following screen shot shows where I place it for most builds. The example I’m showing is the top half of my sequence for building Citrix Provisioning Services servers.

MDT Task Sequence-Set-IPV4Address.ps1

I wrote the Set-IPV4Address.ps1 PowerShell script so that it can be run independently and used for other purposes, so it’s quite a versatile script. It’s fully documented throughout.

I will build on this as I get time, but please let me know if there is anything you feel I haven’t considered or if there is something you would like added.

Perhaps Microsoft will like what I’ve done and integrate my code with the next release of MDT 🙂


Jeremy Saunders

Jeremy Saunders

Independent Consultant | Contractor | Microsoft & Citrix Specialist | Desktop Virtualization Specialist at J House Consulting
Jeremy is a highly respected, IT Professional, with over 30 years’ experience in the industry. He is an independent IT consultant providing expertise to enterprise, corporate, higher education and government clients. His skill set, high ethical standards, integrity, morals and attention to detail, coupled with his friendly nature and exceptional design and problem solving skills, makes him one of the most highly respected and sought after Microsoft and Citrix technical resources in Australia. His alignment with industry and vendor best practices puts him amongst the leaders of his field.
Jeremy Saunders
Jeremy Saunders
Jeremy Saunders
  • slutitude

    Excellent work, Mr. Saunders! Just what I needed!

  • xirsteon

    Thank you for the tutorial. I was able to get this working on the first try. We have a location that does not have dhcp server. All devices use static ip. This was a life saver.

  • xirsteon

    Jeremy, thanks again for the script. If I set the IP during WinPe, when once the image gets applied, and reboots, does the IP info gets carried to Windows so Windows know to set the IP based on what was set during WinPE?

    I intend to use this in environment where DHCP is not possible. I tested this in Hyper-V but once the reboot happened, it couldn’t continue to the rest of the deployment process.

    Thanks again.

    • Hi, Thanks for your comments. No, this is not the intention of this script. The Wizard records the IP information into variables and the script will apply them. So where ever you place the script in the task sequence is where the IP Address will be statically set. This is during the Windows build and not WinPE. I haven’t tried doing it from WinPE. I would suggest setting up a DHCP server with a small scope to do this, or use IP Helpers and set the scope up on your main DHCP servers in your main Data Centre(s). Either way, an OSD process will struggle to be successful without being able to leverage DHCP for the most part. Cheers, Jeremy

  • Just reading your comments again, this sounds like a name resolution issue.
    1) Did you set the DNS servers?
    2) Did you set a DNS Suffix
    3) Were you mapping to the deployment server share using NetBIOS name or FQDN?

  • midoryday

    hello Jeremy
    First Thanks very much the scripts is perfect for my Windows 2012 R2 deployment
    I just have an issue for my Windows 2008 R2 deployment
    “This host does support transcription.
    At D:DeployScriptsSet-IPV4Address.ps1:105 char:19
    + Start-Transcript <<<< $logFile
    NotImplemented: (:) [Start-transcript], PSNotSupportedException
    This host does support transcription.
    At D:DeployScriptsSet-IPV4Address.ps1:245 char:20
    + Stop-Transcript <<<<
    NotImplemented: (:) [Stop-transcript], PSNotSupportedException

    thanks you very much

    • Hi midoryday,

      I’ve uploaded a newer copy of the script that wraps the Start-Transcript and Stop-Transcript in a Try/Catch. But I believe the issue is more related to the version of PowerShell you’re running. The default for 2008R2 was PowerShell 2.0, so worth an upgrade if you haven’t already done so.


Previous post:

Next post: