I am very new to Powershell. I am using Windows 7 and pwershell 5.
What I am trying to do is:
display all the network adapters for a system.
Disable all of them
Enable all of them
I am using this code to display all the network adapters:
$wmi = get-wmiobject win32_networkadapter | select name, InterfaceIndex, netenabled
This displays all the network adapters and their status.
But the problem is that, I am not able to disable all pf the network adapters together using this command.
This statement gives me the error:
Method invocation failed because [Selected.System.Management.ManagementObject] does not contain a method named 'disable'.
At line:1 char:1
+ CategoryInfo : InvalidOperation: (disable:String) , RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Is there any alternative way to display all the network adapters and disable or enable all of them together ?
Thanks in advance!