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 = "10.0.0.151"
$gateway = "10.0.0.1"
$subnet = "255.255.255.0"
$dns = "10.0.0.10","10.0.0.11"
$NIC.EnableStatic($ip, $subnet)
$NIC.SetGateways($gateway)
$NIC.SetDNSServerSearchOrder($dns)
$NIC.SetDynamicDNSRegistration("FALSE")
}
IPConfig /all
Credits: Original script taken from here