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”
[code lanugage=“PowerShell”] 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.