How-To Geek

How to Change Your IP Address Using PowerShell


We have already shown you how you can change your IP address from the command prompt, which required long netsh commands, now we are doing the same thing in PowerShell, without the complexity.

Note: The following commands are new in PowerShell v3 and therefore require Windows 8, they also require an administrative command prompt.

Editors Note: This article is probably for our more geeky audience and requires some basic knowledge of IP Addressing and CIDR notation

Changing Your IP Address

We have seen people pulling out their hair trying to change their IP addresses using cryptic WMI classes in older versions of PowerShell, but that changed with PowerShell v3, there is now a NetTCPIP module that brings most of the functionality to native PowerShell. While a bit confusing at first, mostly due to the lack of documentation at the moment, it starts to make sense once the geeks shows you how its done.

Changing an IP Address can be done using the New-NetIPAddress cmdlet, it has a lot of parameters, some of which, are not even documented in Get-Help. So here it is:

New-NetIPAddress –InterfaceAlias “Wired Ethernet Connection” –IPv4Address “” –PrefixLength 24 -DefaultGateway

This assumes the following:

  • The name of the interface you want to change the IP address  for is Local Area Network
  • You want to statically assign an IP address of
  • You want to set a subnet mask of (which is /24 in CIDR notation)
  • You want to set a default gateway of

You would obviously switch the settings out for some that match the addressing criteria for your network.

Setting Your DNS Information

Now here comes another tricky part, it turns out that there is a whole separate module called DNSClient that you have to use to manipulate your DNS Settings. To change your DNS Server you would use:

Set-DnsClientServerAddress -InterfaceAlias “Wired Ethernet Connection” -ServerAddresses,

This assumes that you want to set the primary DNS server for Wired Ethernet Connection to and the secondary DNS server to That’s all there is to it.

Taylor Gibb is a Microsoft MVP and all round geek, he loves everything from Windows 8 to Windows Server 2012 and even C# and PowerShell. You can also follow him on Google+

  • Published 05/14/12

Comments (15)

  1. Bob Eisenberg

    How silly to describe something that only works on Windows 8!
    Need I explain why?

  2. Carwin57

    Agreed! Just a few too many articles centered around an OS that has not even been officially release. Why do I get the feeling that Microsoft has brought back payola!

  3. Bob

    IMHO is much better to set your addresses using DHCP in your router. Not possible to set duplicate addresses that way unless your router is braindead.

  4. Jeff Sadowski

    Doesn’t netsh still work in windows 8?

  5. Taylor Gibb

    @Jeff netsh does still work, but this is a new module in PowerShell, im going PowerShell crazy these days, so i thought id share my finds :)

  6. John

    All it needs is to open a cmd window with Start > Run > cmd
    ipconfig – lists the current IP address details
    ipconfig/release or ipconfig/release all – does what is says
    ipconfig/renew – does what it says
    Bingo – you have a new IP address given to you by your router which won’t conflict with any other on your network.
    … and it works with XP and Windows 7 (and presumably W8 if and when it is available).

  7. Taylor Gibb

    @John, that is very true as long as your network is leveraging the awesome powers of DHCP, unfortunately that isn’t always the case. On a side note, Windows 8 does still support ipconfig.

  8. Dale

    Windows 8 may be exciting and fun, but it’s not a replacement for Windows 7, surely. Maybe How-to Geek needs two versions; one for each OS. (I’m sure you geeks aren’t too busy for that :-) !!!

  9. Taylor Gibb

    @everyone, The truth is that the RC for Windows 8 is set to drop in less than two months, I think the product might even ship by October. So while it might not be a replacement for Windows 7 yet, soon, it will be. Regardless if you like Metro or not, its only logical to upgrade to Windows 8 when it is released. When that day comes, we would like to have a lot of Windows 8 published already.

    Now that I got my rant out the way :) (BTW i didn’t mean to be rude in any shape or form). @Dale i believe we are working on a Windows 8 category at the moment.

  10. pbug56

    To Taylor Gibb,

    Why would it be logical to downgrade to Windoze 8 Mutro and its unusable (unless your a pet or a toddler using a touch screen) GUI? No matter how good it MAY be underneath, it is unusable unless Microsloth backs off on eliminating things like the start menu. It’s so bad I wouldn’t even take it on a new PC.

  11. Taylor Gibb

    @pbug56 I actually enjoy the Metro interface, I stated using it on my MAIN system since it was in the Dev Preview and it hasn’t let me down once. People are scared of change, at first so was I, but I got with the times. Technology moves on, removing the start menu probably wasn’t the best decision on Microsofts part, but its not the worst (erm Windows Vista). At the end of the day, none of that even matters, curse it all you want, its the way forward and if you want to keep up with technology, you sometimes just have to embrace change.

    As for the people who don’t care about technology, no one is going to force you to upgrade and by them time Windows 7 reaches the end of its lifecycle Windows 9 will be out.

    Sorry for ranting in the comment, I think its totally justified in this situation…

  12. RG

    According to the article, Powershell V3 requires Windows 8. That doesn’t seem to be the case. I just downloaded a version for Windows 7… If the article meant that it required some Powershell V3 functionality only available in Windows 8, that is different. But, it wasn’t clear about that…

  13. RG

    It appears that the specified commands are Windows 8 commands, not PowerShell V3 commands as had been implied. They are not available on my Windows 7 system.

  14. Justin

    @John – What if you’re changing the ip of a server that 20 client machines point to.

    Thanks for posting the command. I’ve been using Server 8 for a few weeks now and I dig it. Although, to be honest, I made the ‘autohotkey’ start button – old habits die hard.

  15. changeyouripaddr

    This is nice post and this post is really appreciable and very informatics regarding how to change ip address.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!