How do I assign static IP addresses with MDT?

Applies to: Microsoft Deployment Toolkit (MDT) 8456 and later
Last updated: May 2025


Problem

By default, MDT-configured deployments use DHCP to assign network settings. You want to assign static IP addresses to target machines automatically during deployment.


Solution

There are two supported methods for assigning static IPs in MDT:

  1. Using CustomSettings.ini variables
  2. Running a PowerShell script during the Task Sequence

Important: Static IP configuration should only be used when necessary—DHCP is more scalable and flexible for most environments.


Option 1: Use CustomSettings.ini Static IP Variables

You can specify static network settings directly in CustomSettings.ini.

Example:

[Settings]
Priority=Default

[Default]
SkipLocaleSelection=YES
SkipTimeZone=YES
SkipDomainMembership=YES
SkipComputerBackup=YES
SkipApplications=YES
SkipSummary=YES
SkipFinalSummary=YES

IPAddress=192.168.1.100
SubnetMask=255.255.255.0
Gateway=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4

This method is simple but not dynamic—each system will get the same IP unless you define separate sections per machine or location.


Option 2: Use a PowerShell Script in the Task Sequence

This is the most flexible and scalable method. You can assign static IPs based on MAC address, computer name, or external data sources (CSV, database, etc.).

Step 1: Create the Script

Example PowerShell (SetStaticIP.ps1):

$interface = Get-NetAdapter | Where-Object {$_.Status -eq "Up"}
New-NetIPAddress -InterfaceAlias $interface.Name -IPAddress "192.168.1.101" -PrefixLength 24 -DefaultGateway "192.168.1.1"
Set-DnsClientServerAddress -InterfaceAlias $interface.Name -ServerAddresses "8.8.8.8","8.8.4.4"

Step 2: Add to MDT

  • Save the script in:
    \\MDTServer\DeploymentShare$\Scripts\SetStaticIP.ps1
  • In your Task Sequence:
    • Click Add > General > Run PowerShell Script
    • Command line: powershell.exe -ExecutionPolicy Bypass -File "%SCRIPTROOT%\SetStaticIP.ps1"

Place this step after the OS is installed but before the domain join.


Option 3: Dynamically Assign by Computer Name or MAC

Use separate [section] blocks in CustomSettings.ini:

[Settings]
Priority=MACAddress, Default

[00:11:22:33:44:55]
IPAddress=192.168.1.101
SubnetMask=255.255.255.0
Gateway=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4

[Default]
IPAddress=192.168.1.150

You can find a machine’s MAC address using:

getmac /v

Best Practices

  • Use scripts or sectioned rules if deploying to many machines with unique IPs.
  • Store static IP logic externally (e.g., pull from a CSV or database) for easier updates.
  • Log and validate IP configuration post-deployment.

Notes

  • Static IPs may conflict if the same IP is reused—ensure uniqueness.
  • Logs related to NIC configuration can be found in:
    • ZTINICConfig.log
    • ZTIGather.log

You may also like...