I am developing hardware that communicates via Ethernet, and as part of the testing often have to switch a single port between two or more different configurations (such as DHCP vs. static IP- with different IPs).

Is there some utility that would allow different port configurations to be stored and easily accessed with a click or two. Alternately, what would be a good scripting approach?

1 Answer 1


PowerShell could script it - example:

$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"
$wmi.EnableStatic("", "")
$wmi.SetGateways("", 1)

More info here: https://blogs.technet.microsoft.com/heyscriptingguy/2012/02/28/use-powershell-to-configure-static-ip-and-dns-settings/

  • Looks perfect for the application. Oct 4, 2017 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.