Thursday, 15 September 2016

New-NetIPAddress: PowerShell command to configure Static Ip Address

PowerShell command to configure Static Ip Address

  • Many times we have to configure Ipadress
  • Its usually done for servers where static ip address are given.
  • To set Static Ip adress you need to know the Network Interface for which you want to set the IP
  • To configure you use the command "New-NetIPAddress"
New-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "AdminNet" `
-IPAddress 192.168.10.2 -PrefixLength 24 -DefaultGateway 192.168.10.1

  • -AddressFamily tells whether its IPV4 or IPV6
  • -InterfaceAlias tells the Name of the network.
  • -IPAddress specify the ip adress you want to configure.
  • -PrefixLength speciy the Subnet length.
  • -DefaultGateway specify the Gateway IP.

No comments:

Post a Comment