Sunday, April 24, 2011

Blog Post: PowerShell script helps you to configure static IP on localmachine

This PowerShell script helps you to configure static IP on localmachine, just copy the code and past it in txt file then rename it to anyname.ps1 “static.ps1″

Don’t forget to make executionpolicy to be remotesigned using Set-ExecutionPolicy remotesigned -Confirm:$false -Force but you have to run the PowerShell console as Administrator.

$NICs = Get-WMIObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq "TRUE"}
Foreach($NIC in $NICs) {
$NIC.EnableStatic("192.168.100.66", "255.255.255.0")
$NIC.SetGateways("192.168.100.1")
$DNSServers = "192.168.100.2","192.168.100.3"
$NIC.SetDNSServerSearchOrder($DNSServers)
$NIC.SetDynamicDNSRegistration("FALSE")
}

Blu Cantrell Jaime King Lokelani McMichael Freida Pinto Eva Longoria

No comments:

Post a Comment