The Scripting Guys at Microsoft have created an amazingly vital and under-advertised PowerShell script that lets you interactively explore the WMI.
Download it here
Then copy it somewhere convenient.
Then run it from your PowerShell prompt: ./WMIExplorer.ps1
Now, you probably want to start by double clicking ROOT\CIMV2, the best stuff is in there.
Filed in Uncategorized
|
WMI classes are typcially collections. Of the members of these collections, you typcially only want to work with one.
Calling Get-WMIObject $className will give you every bit of information about every one of them.
To explore in a cleaner manner, add the following two functions to your PowerShell profile. This function will get just the names of the collection members. Use it to decide which collection member you would like to work with.
function List-WMI( [string] $class )
{
$strComputer = "."
Filed in Uncategorized
|
Here’s a quick command that uses the WMI class Win32_NetworkAdapter to list all your existing network connections.
Get-WMIObject Win32_NetworkAdapter | Format-List Name, MACAddress, AdapterType | less
It can be shortened using aliases for Get-WMIObject and Format-List
gwmi Win32_NetworkAdapter | fl Name, MACAddress, AdapterType | less
Looks easy now that you’ve seen it, right?
If you find that the Win32_NetworkAdapter class can’t do what you need; have a look at the Win32_NetworkAdapterConfiguration class.
Enjoy!
Filed in Uncategorized
|