Useful WMI Commands

Reading Time: < 1 minute

Search WMIObjects

Get-WmiObject -Namespace Root\cimv2 -list | where {$ -like '*disk*'}

Awesome WMI explorer tool can be found here –

WMI contains more properties that Standard Powershell commands eg. Get-Service

Get-WmiObject -Class Win32_Service | Select-Object *

WMI Win32_operatingsystem last boot uptime conversion

$os = gwmi win32_operatingsystem

EG  -24 October 2017 09:37:51

Convert to shortstring


EG – 24/10/2017

Get list of Services that start automatically

Get-WmiObject -Class Win32_Service -Filter "state = 'running' and startmode = 'auto'" | Select-Object name, startmode, description | Format-table -AutoSize

Get BIOS information

Get-WmiObject -Class Win32_Bios

Get Computer information

Get-WmiObject Win32_Computersystem | Format-List Name, manufacturer, model, SystemType 
$computerVideo = Get-WmiObject Win32_VideoController  -ComputerName localhost
        write-host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan
        "Video Info: " + $computerVideo.description

Get Video Card information

Get-WmiObject Win32_VideoController

Get Detailed information

$ComputerName = "localhost"
foreach ($Computer in $ComputerName)
    $ComputerVideoCard = Get-WmiObject Win32_VideoController -ComputerName $Computer
    $Output = New-Object -TypeName PSObject
    Foreach ($Card in $ComputerVideoCard)
        $Output | Add-Member NoteProperty "$($Card.DeviceID)_Name" $Card.Name
        #$Output | Add-Member NoteProperty "$($Card.DeviceID)_Description" $Card.Description #Probably not needed. Seems to just echo the name. Left here in case I'm wrong!
        $Output | Add-Member NoteProperty "$($Card.DeviceID)_Vendor" $Card.AdapterCompatibility
        $Output | Add-Member NoteProperty "$($Card.DeviceID)_PNPDeviceID" $Card.PNPDeviceID
        $Output | Add-Member NoteProperty "$($Card.DeviceID)_DriverVersion" $Card.DriverVersion
        $Output | Add-Member NoteProperty "$($Card.DeviceID)_VideoMode" $Card.VideoModeDescription

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *