ProTechGurus

Learn By Self | Served By Experts

Buy Here: AWS Cloud Step By Step Lab Manual Guide

Deal of the month

Windows Server 2016 Hands-on Practical Guide with Virtual Machine Lab Setup

  • CCNA
    • Routing
    • Switching
    • IPv6
    • Security
    • Juniper
  • GNS3 Labs
  • VMware
  • VirtualBox
  • Windows
    • Windows Server 2016
    • Windows 10
    • SCVMM
  • Linux
    • Ubuntu
    • RHEL
  • AWS Cloud
  • Blogging Tutorilas
    • Internet Tips
You are here: Home / Windows / Windows 10 / How To Set Static IP Using PowerShell in Windows

August 31, 2016 by ProTechGurus

How To Set Static IP Using PowerShell in Windows

In the previous post, we have explained a step by step guide to configure static IP using GUI and CLI methods. Setting static IP address and other TCP/IP settings using GUI is fairly easy. However, setting IP address using CLI method is a little bit complicated. There are tools that you can use to set or configure static IP in Windows systems: Using the netsh CMD command and NewNetIPAddress PowerShell cmdlet. Here, we are going to explain how to set static IP using PowerShell.

Setting Static IP Using PowerShell

Before setting and configuring static IP using Windows PowerShell, let’s understand the New-NetIPAddress cmdlet and its syntax.

New-NetIPAddress –InterfaceIndex “Interface Index Number” –IPAddress "Your IPv4 Address" –PrefixLength "Network ID" -DefaultGateway "Your Default Gateway"

To configure or set static IP using PowerShell, you need to perform the following steps:

  1. First of all, execute the Get-NetAdpater PowerShell cmdlet to view all the network adapters on your Windows system.
    Get-NetAdpater

    View Current IP address using Get-NetIPAddress PowerShell cmdletNote down the Index Number of the network adapter for which you want to set Static IP. For example, we want to set static IP on the Ethernet 2 network adapter. As shown in the preceding figure, its index number is 32.

  2. For example, let’s see how to set following TCP/IP settings using PowerShell.
    • IP Address: 192.168.100.100
    • Subnet Mask: 255.255.255.0
    • Default Gateway: 192.168.100.1
    • Interface Name: Ethernet 2
    • Interface Index Number: 32
  3. To set preceding TCP/IP settings, execute the following PowerShell cmdlet:
    New-NetIPAddress –InterfaceIndex “32” –IPAddress “192.168.100.100” –PrefixLength 24 -DefaultGateway 192.168.100.1

    Configure Static IP using PowerShell cmdlet

  4. In the preceding figure, you can see the TCP/IP settings have been configured using the New-NetIPAddress PowerShell cmdlet.

Removing IP Address Using Windows PowerShell

  • If you have done something wrong and decide to remove a specific IP address, use the following PowerShell cmdlet.
C\>Remove-NetIPAddress -IPAddress <IP Address that you want to remove>
  • For example, use the following cmdlet to remove previously configure static IP address.
C\>Remove-NetIPAddress -IPAddress 192.168.100.100

Remove-NetIPAddress Syntax Example

For more information about managing TCP/IP settings on Windows using PowerShell, visit the Microsoft’s official TechNet library. The following are some of the important cmdlet links that you might like.

  • New-NetIPAddress PowerShell cmdlet
  • Set-NetIPAddress PowerShell cmdlet
  • Remove-NetIPAddress PowerShell cmdlet

Here, we have explained how to configure or set static IP using PowerShell in Windows systems such as Windows 8/10 and Windows Server 2012/2016. Do share the article to your friend circle.

❮❮ Previous Post
Next Post ❯ ❯

Windows Server 2016 – Lab Manual Guide

The Best CCNA Self Study Guide

Like Us

AWS Cloud Self Learning Guide

Recent Posts

  • How To Scan EC2 Instances Using Amazon Inspector
  • Creating and Using AWS NAT Gateways – Step By Step
  • How To Create and Use AWS Internet Gateways
  • How To Create and Manage AWS Virtual Private Cloud (VPC)
  • Step By Step Guide To Create AWS Account Without Credit Card

Newsletter

  • Contact Us
  • Terms and Conditions
  • About Us

Copyright © ‘2018’ · ProTechGurus ·

Pretty Chic Theme By: Pretty Darn Cute Design