Our Score
Click to rate this post!
[Total: 0 Average: 0]
- In Windows PowerShell, run
Get-NetIPInterface. - Make a note of the number shown in the IfIndex column of the output for your IP interface or the InterfaceDescription string. If your computer has more than one network adapter, make a note of the number or string corresponding to the interface for which you wish to set a static IP address.
- In Windows PowerShell, run
New-NetIPAddress –InterfaceIndex 12 –IPAddress -192.0.2.2 –PrefixLength 24 –DefaultGateway -192.0.2.1Where:
InterfaceIndexis the value of IfIndex from Step 2 (in this example, 12)IPAddressis the static IP address you intend to set (in this example, 192.0.2.2)PrefixLengthis the prefix length (another form of subnet mask) for the IP address you intend to set (in this example, 24)DefaultGatewayis the default gateway (in this example, 192.0.2.1) - In Windows PowerShell, run
Set-DNSClientServerAddress –InterfaceIndex 12 -ServerAddresses 192.0.2.4Where:
InterfaceIndexis the value of IfIndex from Step 2ServerAddressesis the IP address of your DNS server - To add multiple DNS servers, run
Set-DNSClientServerAddress –InterfaceIndex 12 -ServerAddresses 192.0.2.4,192.0.2.5Where in this example, 192.0.2.4, 192.0.2.5 are both IP addresses of DNS servers
If you need to switch to using DHCP, use the Windows PowerShell command Set-DnsClientServerAddress –InterfaceIndex 12 –ResetServerAddresses.
Found on technet
Our Score
Click to rate this post!
[Total: 0 Average: 0]