Skip to main content
To set a static IP on Windows Server with PowerShell, run New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 203.0.113.10 -PrefixLength 24 -DefaultGateway 203.0.113.1, then set DNS with Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses ("198.51.100.53","198.51.100.54"). Use the address, prefix and gateway your provider gives you. Do it from the VNC console, because a mistake drops your Remote Desktop session.

Before you start

  • Get your network details. On a FREAKHOSTING VPS they are on the Network tab of the VPS Panel: address, Gateway, Netmask and Resolvers (view network settings). On a dedicated server, if you don’t have them, open a ticket.
  • Convert the netmask to a prefix length: 255.255.255.0 is /24, 255.255.255.128 is /25, 255.255.254.0 is /23.
  • Open the VNC console and run the commands there, as Administrator.
Changing the IP, prefix or gateway of the interface you are connected through disconnects Remote Desktop if anything is wrong. Work in the VNC console (or KVM/IPMI on a dedicated server) and write down the current settings first.

How to see the current IP settings

Note the InterfaceAlias (often Ethernet or Ethernet 2) and InterfaceIndex. Use either one in the commands below. ipconfig /all shows the same information and whether DHCP Enabled is Yes.

How to set a static IP with PowerShell

1

Remove the old default gateway (if one exists)

If the interface already has a default gateway (for example from DHCP), remove it so you don’t end up with two default routes:
2

Add the static address and gateway

If DHCP was on, Windows turns it off for this interface automatically. The gateway must be in the same subnet as the address.
3

Set the DNS servers

4

Remove an old address (only if you changed IP)

If the interface still has a previous address you no longer want:

How to set a static IP with netsh

netsh replaces the address, mask and gateway in one command, which is handy in Command Prompt:

How to set a static IP with SConfig

SConfig is Windows Server’s built-in text menu and works well in the VNC console.
1

Open Network settings

Type SConfig in an admin PowerShell window, then 8 (Network settings) and the number of your network adapter.
2

Set the address

Choose 1 (set network adapter address), then S for static. Enter the IP address, the subnet mask (for example 255.255.255.0) and the default gateway.
3

Set DNS

Choose 2 (set DNS servers) and enter the preferred and alternate DNS server.

How to change only the DNS servers

DNS (Domain Name System) turns names like example.com into IP addresses. To change only the resolvers:
To go back to the DNS servers handed out by DHCP: Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses. On a VPS you can also pick resolvers in the panel; see change DNS resolvers.

How to check it worked

IPv4Address, IPv4DefaultGateway and DNSServer should show your new values, the ping should succeed (if the target answers ping), and Resolve-DnsName should return an address. Then connect with Remote Desktop again from your own computer.

How to switch back to DHCP

Only do this if your network actually provides DHCP; otherwise the server loses its address.

Frequently asked questions

What is the difference between PrefixLength and subnet mask?

They describe the same thing. A prefix length of 24 equals the mask 255.255.255.0. PowerShell uses the prefix length; netsh and SConfig use the mask.

New-NetIPAddress gives an error about the gateway. What now?

The interface probably already has a default route. Remove it with Remove-NetRoute -InterfaceAlias "Ethernet" -DestinationPrefix "0.0.0.0/0" and run New-NetIPAddress again, or use the single netsh interface ipv4 set address command, which replaces the address and gateway together.

Can I add more IP addresses the same way?

Yes, but add extra addresses without a gateway. See add additional IP addresses on Windows Server.

I lost Remote Desktop after changing the IP. How do I fix it?

Sign in through the VNC console, run Get-NetIPConfiguration and correct the address, prefix or gateway. If the network is badly broken, see flush DNS and reset the network stack.

VPS and dedicated server guides

Every guide in this section.

Add additional IP addresses

Secondary IPs on one adapter.

Enable IPv6 on Windows Server

Add a static IPv6 address.

Find your server IP

On Linux and Windows.

VPS network settings

Your gateway, netmask and resolvers.

Checked against Microsoft Learn: New-NetIPAddress, Remove-NetRoute, Set-DnsClientServerAddress, netsh interface and SConfig on 4 November 2026. Commands were not tested on a live Windows server for this page; sample output is shortened.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026