Useful WMI queries with PowerShell

WMI queries are a good way to discover information about you Windows environment. You may need to make changes to your windows firewall policy to allow WMI queries remotely. When you have this in place you can do things like finding the serial number or mac address of any or all of the computers in your environment.

Here are some queries that I find useful to find more queries use a WMI browser.

Get-WmiObject -Class win32_bios

This is a handy way to find the serial number of a computer or server.

Get-WmiObject -Class win32_networkadapterconfiguration

Get-WmiObject -Class win32_networkadapter

These two commands can be used to discover ip addresses and mac addresses

Get-WmiObject -Class win32_computerSystem

This can find information about :

Domain
Manufacturer
Model
Name
PrimaryOwnerName
TotalPhysicalMemory

Get-WmiObject -Class win32_desktopmonitor

This can find the manufactures and model number of desktop monitors. (as long as the monitor shares that information). You could find out which users still have say an Acer monitor if you are rolling out Dell monitors.

Get-WmiObject -Class win32_logicaldisk

This show information about partitions like capacity and free space.

Get-WmiObject -Class win32_operatingsystem

This can be used to find:

RegisteredUser, SerialNumber, ServicePackMajorVersion, ServicePackMinorVersion, Caption , and Version

Get-WmiObject -Class win32_printer

This provides information about the available printers for a computer.

Get-WmiObject -Class win32_processor

Provides information about the processor.

Get-WmiObject -Class win32_product

This can be used to determine what programs are installed on a computer. It could be used to track down unauthorized software.

Get-WmiObject -Class win32_timezone

checks what time zone a computer is in.

Get-WmiObject -Class win32_utctime

gives the current UTC time and date of a computer. Useful for troubleshooting time related problems.

GET-WmiObject -Class win32_optionalfeature

This gives information on windows features useful when you have to query 2008 servers where Get-WindowsFeature will not work.

(Get-WmiObject -Class win32_computersystem).username

This can be used on a workstation to figure out who is the currently logged on user. If used in conjunction with an active directive query you can find out who is logged on to all of your computers.