Useful WMI and WQL queries

Share

The WMI or WQL queries in ConfigMgr are used to go back in a collection, for example, all the computers of a particular manufacturer or model. In a sequence the task of applying a specific package or application to a computer model, etc.

Dell

All Dell computers

WMI

SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE "%Dell%"

WQL

select SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join is SMS_G_System_COMPUTER_SYSTEM SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Manufacturer like '%Dell%'

Dell model in particular

WMI

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%Latitude 5501%"

WQL

SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM we SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Model = "Latitude 5501"

HP

All HP computers

WMI

SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE "%Hewlett-Packard% "or Manufacturer LIKE"%HP%"

WQL

select SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join is SMS_G_System_COMPUTER_SYSTEM SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Manufacturer like '%Hewlett-Packard% 'or SMS_G_System_COMPUTER_SYSTEM.Manufacturer like'%HP%'

HP model in particular

WMI

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%EliteBook 840 G6%"

WQL

SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM we SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Model = "EliteBook 840 G6"

Lenovo

All Lenovo computers

WMI

SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE "%Lenovo%"

WQL

select SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join is SMS_G_System_COMPUTER_SYSTEM SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Manufacturer like '%Lenovo%'

Lenovo model in particular

Warning Lenovo has decided not to do like everyone else ... You will need either the name of the product or the model in coded form which can be found on the Lenovo site.

WMI

SELECT * FROM Win32_ComputerSystemProduct WHERE Version LIKE "%ThinkPad W541%"

WQL

select SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM we SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Model Like "20EGS%"

Microsoft Surface

All Microsoft Surface computers

WMI

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%Surface%"

WQL

SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM we SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Model like = "%Surface%"

Microsoft Surface model in particular

WMI

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%Surface Pro 6%"

WQL

SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM we SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Model like = "%Surface Pro 6%"

Apple

All Apple computers

WMI

SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE "%Apple%"

WQL

select SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join is SMS_G_System_COMPUTER_SYSTEM SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Manufacturer like '%Apple%'

Apple model in particular

WMI

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%MacBookPro16,1%"

WQL

SMS_R_System.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM we SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceID Where SMS_G_System_COMPUTER_SYSTEM.Model = "MacBookPro16,1"

virtualization

All virtual machines

WMI

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%Virtual%"

WQL

select * from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model like "%Virtual%"

Hyper-V

WMI

SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE "%Microsoft% "AND Model LIKE"%Virtual Machine%"

WQL

select * from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Manufacturer like "%Microsoft% "and SMS_G_System_COMPUTER_SYSTEM.Model like"%Virtual Machine%"

VMWare

WMI

SELECT * FROM Win32_ComputerSystem WHERE Manufacturer LIKE "%VMware% "AND Model LIKE"%VMware Virtual Platform%"

WQL

select * from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Manufacturer like "%VMWare% "and SMS_G_System_COMPUTER_SYSTEM.Model like"%VMware Virtual Platform%"

VirtualBox

WMI

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%VirtualBox%"

WQL

select * from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model like "%VirtualBox%"


Share

Steven Bart

Founder of StevenBart.com - Vevey, Switzerland. I have been in IT since 2001, I work as a Workplace Architect and mainly deal with the administration of MEMCM (SCCM), the mass deployment of workstations and applications. Learn more about me.

    Leave a comment

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