Query, Guide, Microsoft, SCCM, SQL

SCCM Collection Query – Virtual Machines

Last updated on September 25th, 2021 at 08:57 pm

Read Time:28 Second

If you are looking for a SCCM collection query for virtual machines in your environment, then you can use this query below:

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
  where SMS_R_System.ResourceId not in
(select SMS_R_SYSTEM.ResourceID 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%")
Click to rate this post!
[Total: 0 Average: 0]
Avatar for Andrew Armstrong

About Post Author

Andrew Armstrong

Founder of TechyGeeksHome and Head Editor for over 15 years! IT expert in multiple areas for over 23 years. Sharing experience and knowledge whenever possible! Making IT Happen.
administrator

2 thoughts on “SCCM Collection Query – Virtual Machines

  1. The query actually gets all non-VM machines. I changed it to be as follows,
    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 where SMS_R_System.ResourceId in (select SMS_R_SYSTEM.ResourceID 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%”)

  2. The query actually gets all non-VM machines. I changed it to be as follows,
    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 where SMS_R_System.ResourceId in (select SMS_R_SYSTEM.ResourceID 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%”)

Leave us a message...

This site uses Akismet to reduce spam. Learn how your comment data is processed.