You can modify the default NIC mapping object of a customization specification and apply the specification on a newly created virtual machine.

1

Create a nonpersistent customization specification for Windows operating systems.

New-OSCustomizationSpec -Type NonPersistent -Name Spec -OSType Windows -Workgroup Workgroup -OrgName Company -Fullname User -ProductKey “valid_key” -ChangeSid -TimeZone "Central European" -NamingScheme VM
2

View the default NIC mapping objects of the Spec specification.

Get-OSCustomizationNicMapping -Spec Spec | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress 172.16.1.30 -SubnetMask 255.255.255.0 -DefaultGateway 172.16.1.1 -Dns 172.16.1

Each customization specification object has one default NIC mapping object.

3

Modify the default NIC mapping object of the Spec customization specification to use static IP.

Get-OSCustomizationNicMapping -Spec Spec | Set-OSCustomizationNicMapping  -IpMode UseStaticIP -IpAddress 172.16.1.30 -SubnetMask 255.255.255.0 -DefaultGateway 172.16.1.1 -Dns 172.16.1.1
4

Create a new virtual machine named VM1 from a template, and apply the static IP settings.

New-VM -Name VM1 -VMHost Host -Datastore Storage1 -OSCustomizationSpec Spec -Template Template