IT Systems Engineering

Setting a static IP using powershell

Here is a quick way to set your IP address to a static value:

$NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -computername . | where{$_.IPEnabled -eq $true -and $_.DHCPEnabled -eq $true} 
Foreach($NIC in $NICs) { 
    $ip = ""
    $gateway = ""
    $subnet = ""
    $dns = "",""
    $NIC.EnableStatic($ip, $subnet) 
IPConfig /all

Credits: Original script taken from here

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove that you are a human *