0

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?

2

PowerShell could script it - example:

$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"
$wmi.EnableStatic("10.0.0.15", "255.255.255.0")
$wmi.SetGateways("10.0.0.1", 1)
$wmi.SetDNSServerSearchOrder("10.0.0.100")

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. – Spehro Pefhany Oct 4 '17 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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