MEA Center of Expertise

We are a 120+ technology enthusiasts helping Microsoft customers around Middle-East & Africa region. We bridge Microsoft tools & technologies to their businesses.

PowerShell script helps you to configure static IP on localmachine

PowerShell script helps you to configure static IP on localmachine

  • Comments 3
  • Likes

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")
}

Comments
  • In an ideal world this script would almost work but I'm not sure if I'd call this script ready for prime time,  

  • This script is already tested

  • Sorry the fact that your setting all nics to the same ip settings seems to be an issue.

    tr

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment