Hello,
I have two nics (wan/lan) and I would like for them not to be on a the same time.
I can disable the existing nic by use the Set-NetworkAdapter cmdlet, but I'm not sure how I should get the stauts of the existing nic.
My psuedo code should look something like.
If WAN_NIC:Connected = True {
Get-VM Server01 | Get-NetworkAdapter | ?{_.NetworkName -eq "LAN NIC"} | Set-NetworkAdapter -Connected|$false -Confirm:$false}
If LAN_NIC:Connected = True {
Get-VM Server01 | Get-NetworkAdapter | ?{_.NetworkName -eq "WAN NIC"} | Set-NetworkAdapter -Connected|$false -Confirm:$false}
Now my question is how do I get the connection status of the nic? Get-NetworkAdapter does not appear to show this status.
Also, any ideas on how I can enforce this? I could run it on a scheduled task, but I'd prefer to have it event driven. I'm not sure the best way to do this, short of a c# type application.
Thanks
-Kevin