none
Provide Static IP Based on PC Name RRS feed

  • Question

  • I have a requirement to assign static IP address to every PC that we install OS on according to the PC name, for example, if the PC name is PC01 the IP Address should be 192.168.1.1 and if PC name is PC12 the IP address should be 192.168.1.12.

    I don't have any idea about sysprep unattended file, so I need as much help as possible from you guys.

    Another thing, I don't want to use DHCP since I may replace the PC so that's why I need to do this using unattended file if possible.

    BR,

    Nader

    Monday, July 8, 2013 3:34 PM

All replies

  • There are a few ways to do this.  The variable you want is OSDAdapter0IPAddressList (you'll probably also need to set the other related variables like OSDAdapter0MacAddress, OSDAdapter0EnableDHCP, OSDAdapter0SubnetMask, OSDAdapter0Gateways, OSDAdapter0DNSSuffix and OSDAdapter0DNSServerList if you aren't using DHCP).

    One of the simplest ways to do this if you are using the MDT Database and matching the machine by MAC or UUID.  You can set each of these variables on the Computer object in the Database where you are already likely setting the PC name.

    If you aren't using the MDT Database, you could use a User Exit script to read the name, format the # part off, then assign it to the IPAddressList.  Mikael has a good post about using the User Exit in CustomSettings.ini plus an example to get you started here: http://deploymentbunny.com/2013/03/06/back-to-basiccustomsettings-inisample-2/


    David Coulter | http://DCtheGeek.blogspot.com | @DCtheGeek

    Monday, July 8, 2013 3:51 PM
    Answerer
  • Unfortunately I am using another software that has pre settings configured such as Time Zone, Join to the Domain, OU Placement. The only customization that I can do is to provide unattended sysprep file, is this possible with only using the unattended file?

    Monday, July 8, 2013 3:59 PM
  • Yes, you can set it directly in the Unattend.xml:  http://technet.microsoft.com/en-us/library/ff715665(WS.10).aspx

    David Coulter | http://DCtheGeek.blogspot.com | @DCtheGeek

    Monday, July 8, 2013 4:06 PM
    Answerer
  • This can be very useful, but is there a way to have something like IF statement that I can use to specify the IP address to the correct PC name?
    Monday, July 8, 2013 4:23 PM
  • Not that I'm aware of besides some scripting.  MDT does this for you as it reads the CustomSettings and then configures the Unattend.xml with the variables, then applies it to the machine with DISM.  How are you applying the Unattend.xml now or the different computer names (like 'PC01' or 'PC12')?

    David Coulter | http://DCtheGeek.blogspot.com | @DCtheGeek

    Monday, July 8, 2013 4:41 PM
    Answerer