PowerTip: Use PowerShell to Configure IP Address in Windows Server 2012 R2

Summary: Use the new cmdlets in Windows Server 2012 R2 to set up an IP address on a computer with one network adapter.

Hey, Scripting Guy! Question How can I use Windows PowerShell to configure an IP address in Windows Server 2012 R2?

Hey, Scripting Guy! Answer Use the Get-NetAdapter and Add-NewIPAddress cmdlets together.

   For the IP address of, with a gateway of, and 24 bits for the subnet mask (




Get-NetAdapter | NEW-NetIPAddress -IPAddress $IPAddress -Defaultgateway $Gateway -Prefixlength $Prefix

Comments (5)

  1. Ronald Wildenberg says:

    In the first answer line it says Add-NewIPAddress but that should be New-NetIPAddress as in the example.

  2. brian- says:

    does not work

  3. Jorell says:

    It would be nice if they would state the PowerShell version requirements.

  4. Muzaffar Shaik says:

    i think these are the new commands added to v3 and may require windows 8 or server 2012 r2 and above

  5. Denard says:

    It do work,thanks

Skip to main content