Static IP on Windows Server: GUI and PowerShell
There are two ways to assign a static IP on Windows Server: through the “Network Connections” graphical interface or with the PowerShell command New-NetIPAddress. On a remote server reached over RDP, PowerShell is safer — it sets the address and the gateway in a single command. Both options are covered below, step by step.
Option 1. Through the graphical interface
- Press
Win + R, typencpa.cpl, press Enter — the list of network adapters opens. - Right-click the active adapter → Properties.
- Select Internet Protocol Version 4 (TCP/IPv4) → Properties.
- Choose Use the following IP address and fill in the fields:
- IP address:
203.0.113.10 - Subnet mask:
255.255.255.0 - Default gateway:
203.0.113.1
- IP address:
- Choose Use the following DNS server addresses:
1.1.1.1and8.8.8.8. - Click OK.
Warning: over RDP, changing the IP drops your current session. Make sure the new address is correct, otherwise you will need the KVM console to get back in.
Option 2. Through PowerShell
Open PowerShell as Administrator.
Step 1. Find the interface index
Get-NetAdapter | Format-Table Name, InterfaceDescription, ifIndex, Status
Note the ifIndex of the active adapter (for example 12).
Step 2. Assign the static IP and gateway
New-NetIPAddress -InterfaceIndex 12 -IPAddress 203.0.113.10 -PrefixLength 24 -DefaultGateway 203.0.113.1
The -PrefixLength 24 parameter corresponds to the 255.255.255.0 mask.
Step 3. Set the DNS servers
Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses ("1.1.1.1","8.8.8.8")
Step 4. Verify the result
Get-NetIPConfiguration -InterfaceIndex 12
Subnet mask to prefix length
| Subnet mask | PrefixLength |
|---|---|
| 255.255.255.0 | 24 |
| 255.255.255.128 | 25 |
| 255.255.0.0 | 16 |
| 255.0.0.0 | 8 |
Testing the network after the change
Once the address is assigned, confirm connectivity works at every level. Check the gateway and DNS:
Test-NetConnection -ComputerName 1.1.1.1
Resolve-DnsName example.com
The first command tests reachability of an external host (ICMP and routing), the second confirms that name resolution works through the DNS servers you set. If ping by IP succeeds but names do not resolve, the problem is DNS, not routing.
Adding a second IP address
Servers often need several public addresses — for separate sites or certificates. Add an extra IP to the same adapter:
New-NetIPAddress -InterfaceIndex 12 -IPAddress 203.0.113.11 -PrefixLength 24
No gateway is needed — it is already set by the primary address. To list all addresses on the interface:
Get-NetIPAddress -InterfaceIndex 12 -AddressFamily IPv4 | Format-Table IPAddress, PrefixLength
How to switch back to DHCP
If you need to roll back to automatic addressing:
Set-NetIPInterface -InterfaceIndex 12 -Dhcp Enabled
Set-DnsClientServerAddress -InterfaceIndex 12 -ResetServerAddresses
Frequently asked questions
New-NetIPAddress says the address already exists — why?
The interface already has an IP. Remove the old one with Remove-NetIPAddress -InterfaceIndex 12 -Confirm:$false, then set the new one.
I lost RDP after changing the IP — how do I get back? Use the server’s KVM console in the control panel and fix the address. In production, only change the IP when you have console access.
How do I add a second IP to the adapter?
Run New-NetIPAddress again with a different -IPAddress and no -DefaultGateway.
Where do I get the correct gateway and mask? From the VPS control panel or your provider — these values are issued together with the public IP.
Do these commands work on Server Core without a GUI? Yes, the PowerShell method works fully on Server Core, where there is no graphical interface at all.
Need a Windows server with a static public IP ready to go? Deploy a Windows VPS in the VPS hosting section or order server administration.