Setting IP Configuration via PowerShell

1. Identify the Interface Index of the NIC you want to configure.

Get-NetIPAddress

2. Set the IP address on the desired interface

New-NetIPAddress -InterfaceIndex 4 -IPAddress 10.0.0.120 –PrefixLength 24 -DefaultGateway 10.0.0.245

3. Finally, set the DNS addresses

Set-DnsClientServerAddress -InterfaceIndex 4 -ServerAddresses ("10.0.0.115","8.8.8.8")

How do we know this worked?

Get-DnsClientServerAddress

Add comment