Monday, November 16, 2015

Static IP in SCCM Task Sequence

Overview


There have been some scenarios were we have to set a static IP for imaging as we don't have DHCP on that VLAN. MDT does this automatically, however SCCM does not so we came up with a way of handling this scenario.


Solution


This script below is ran very early in the TS, anywhere before the first restart really. It will take the data entered on the Wizard and create variables for the settings so its used later. It also will log it out.

NOTE: I don't recall if I had this written or if it came from another source. Credit where credit is due if its yours.

When you boot up the OSD PE you can select 'Configure Network Settings' on the initial wizard and enter in relevant network information. I would suggest you just do the first interface. This script will in turn populate the following built in variables (complete list) that are used by the TS engine. 


  • OSDAdapter0DNSServerList:x.x.x.x
  • OSDAdapter0EnableDHCP:False
  • OSDAdapter0Gateways:x.x.x.x
  • OSDAdapter0IPAddressList:x.x.x.x
  • OSDAdapter0SubnetMask:x.x.x.x

I would advise to only use the first NIC as some TS parts do not support multiple NICs so those can get setup later. Servers usually have NIC teaming once its deployed so that has to be setup post deployment.

just create a step that runs 'cscript.exe SetStaticIPInTaskSequence.vbs' from the package its in.


Download

This script is provided as-is, no warranty is provided or implied.The author is NOT responsible for any damages or data loss that may occur through the use of this script.  Always test, test, test before rolling anything into a production environment.

You can find the static IP script here.




6 comments:

  1. You just need to put this early in the TS before the first restart, for any reason. This way it populates the variables and they are used during the rest of the TS.

    ReplyDelete
  2. I placed it right before my front end. I modified it to suppress the notifications. Thanks again I owe you some beers.

    ReplyDelete
  3. I am trying to use this script in my MDT TS, but it does not seem to propagate the static IP details entered during the BDD Welcome screen after the first restart.

    Could it be that it will only work with SCCM integrated with MDT?

    ReplyDelete
  4. Hi Kevin - this is awesome, many thanks for sharing. I was looking for a way to reduce touch points and avoid double-entry when provisioning servers (static IP addresses) with SCCM Task Sequences and your script worked perfectly! Nice work! Thank you again,
    -Neil

    ReplyDelete
  5. This script works amazing it's the only one that I could find and incorporate but what would I need to add so that it grabs the Alternate DNS server too and not just the primary? Thank you!

    ReplyDelete