I am looking to run a Power Shell script that does the following:
1. Determine the active NIC and import it. Currently I am able to find the active NICs with this command -
Get-WmiObject -Class win32_NetworkAdapter -ComputerName LocalHost -Filter "NetworkConnectionStatus = 2" | Format-Table Name, NetEnabled, NetConnectionStatus, DeviceID -AutoSize
2. Ask the user which interface to use - if more than one active interface
3. Ask the user if they want a Static (If Static, have the option to enter the IP, Subnet Mask, & Default Gateway or use presets) or Dynamic IP then run one of the following commands
$NIC.EnableDHCP()
or
$NIC.EnableStatic("192.168.1.2","255.255.255.0")
If switching from DHCP to Static, it should first release the IP.
Thanks in advance,
Pat