Get-Wmi Objects in PowerShell

Today is a quick run through of some ways you can use the Get-WmiObject cmdlet.

Get List of WMI_Objects

Get-WmiObject Win32_OperatingSystem

There are many more WMi_Objects for the Operating system than this. To get the full list run:

Get-WmiObject Win32_OperatingSystem | Get-Member

From here you cna find much more info about your machine such as get the Install Date of Operating System:

([WMI]'').ConvertToDateTime((Get-WmiObject Win32_OperatingSystem).InstallDate)

Find up-time of machine

([WMI]'').ConvertToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime)

To get the properties that are not included by default, you need to pipe the Get-WmiObject Win32_OperatingSystem into the Format cmdlets, such as Format-Table:

Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName . | Format-Table -Property TotalVirtualMemorySize,TotalVisibleMemorySize,FreePhysicalMemory,FreeVirtualMemory

Wildcards work, so you can get all properties that include the word “Memory”

Get-WmiObject Win32_OperatingSystem|Format-Table *Memory*

If you have any other ways to use the cmdlet it please share, it will be interesting for all of us to know.

Author: Richie Lee

Full time computer guy, part time runner. Full time Dad, part time blogger. Pokémon Nut. Writer of fractured sentences. Maker of the best damn macaroni cheese you've ever tasted.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s