25 February 2009 4 Comments

How To: Validate Network Connectivity by Subnet in the MDT Task Sequencer

One of the many things in life that really bothers me, is Microsoft Deployment Toolkit’s binary nature. During an OS deployment, everything has to be 100% “as expected”  or the deployment itself tends to fail completely. An incorrect setting can get your 99% through your build process, only to have it fail at the very end and prevent that final important step from running. Grrr….

Another good example of how this can break down a real-world scenario is when you have a 3rd party performing your imaging with no access to your network. In my company, I’ve devised a method to interrupt the Task Sequence and shut down the machine when the 3rd party process is finished. However, all it takes is for them (or us!) to accidentally  power on the workstation off the network to break the whole process – as the resumed Task Sequence would try to join join the domain, install Line of Business applications etc. all of which require network access!

So in order to counter this, I’ve set up explicit checks in our Task Sequence to verify that our network is accessible using a script I’ve built. The script verifies that we are on the correct subnet, i.e. 10.1.x.x and returns a boolean value to a Task Sequence Variable which can be used to control the flow of the TS. Since Task Sequences don’t allow loops, we have to repeat the TS group a few times. This can be as many as you like, but will require additional setup. Here’s an example of how to set it up:

MDT Task Sequence: Validating Network Connectivity

MDT Task Sequence: Validating Network Connectivity by Subnet

In this Task Sequence, we check for network connectivity by Subnet 3 times. If after the 3rd time we still haven’t found it, we fail the whole build process. If at any point during these 3 attempts the correct subnet is found, then we skip the remaining Subnet checks and move on to the actions under the “Network Found” group.

In order to use the script from your own Task Sequence:

  • Download the MDT script here
  • Rename the file from .txt to .wsf
  • Copy the file to the Scripts folder in your Distribution folder
  • Create a new TS ‘Run Command Line’ item, with the following command-line: cscript.exe “%SCRIPTROOT%\zCFG-DetectNetworkBySubnet.wsf” /Subnet:SubnetAddress
  • The Subnet address value should be as follows: “192.” matches 192.x.x.x, “192.168.” matches 192.168.x.x etc.
  • The TS Variable “SubnetAvailable” returns True / False and can then be used in TS condition checks

4 Responses to “How To: Validate Network Connectivity by Subnet in the MDT Task Sequencer”

  1. Peter L. 17 September 2009 at 3:49 pm #
    I’m trying to download the MDT script in order to use with the task Sequence but nothing is happening, what should I do to succeed ?

    Thank you,

    Peter.

    • Dan Cunningham 18 September 2009 at 9:19 am #
      Hey Peter,

      Woops, was a typo in the link. This is now fixed.

      Thanks, Dan

  2. Leigh C 6 November 2009 at 11:12 am #
    Hey Dan,
    I can’t download the script either . . . I get a blank page? :(
    Cheers, Leigh.
    • Dan Cunningham 6 November 2009 at 3:57 pm #
      Hi there.

      The link is definitely working. Just checked it again.

      Dan


Leave a Reply