WMI is an awesome information source for admins. All you need is the name of a WMI class that represents something you find interesting. The easiest way to find a valid WMI class name is to search for it.
This returns all classes with “Share” in their name:
Get-WmiObject -Class *share* -List
Next, use Get-WmiObject to retrieve all instances of a class:
Get-WmiObject -Class win32_share
Don’t forget to pipe the results to Select-Object if you’d like to see all properties:
Get-WmiObject -Class win32_share | Select-Object -Property *
An even better way is to use Get-CimInstance instead of Get-WmiObject because it autoconverts certain data types like DateTime.
This call behaves almost identically to Get-WmiObject:
Get-CimInstance -ClassName Win32_Share
Here, you can see differences:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Name, LastBootupTime, OSType Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property Name, LastBootupTime, OSType