PowerShell for Windows Admins

Sep 30 2010   12:28PM GMT

WMI and Network Adapters: 8



Posted by: Richard Siddaway
Network

We were looking at MAC Addresses last time. We can filter on MAC address

Get-WmiObject -Class Win32_NetworkAdapter -Filter "MACAddress=’00:27:2B:F5:96:D5′"

No its not my real MAC address :-)

There are two useful methods on the NetworAdapter class – Disable and Enable

They couldn’t be easier to use

$nic = Get-WmiObject -Class Win32_NetworkAdapter -Filter "MACAddress=’00:27:2B:F5:96:D5′"

Invoke-WmiMethod -InputObject $nic -Name Disable

aand if you want to bring it back

Invoke-WmiMethod -InputObject $nic -Name Enable

The filter can be modified to work on whichever property is the best for your activities

Comment on this Post

Leave a comment: