WMI script to create a collection based on software ID
I have a lot of old sofware on over 500 servers. I know there is a way to create a collection using WMI queries, but I a noobie at scripting.
I have the Software ID (from SCCM reporting) of the specific software. I am looking to find out all the servers that have Software ID XXXXX-XX-XXX-XX installed on 'All Windows Server Systems' Collection and put them in another collection.
Community Chosen Answer
This powershell module does all the WMI for you.
For the query, use a subselect, but instead of using two collections, which is messy, use the query below for a single collection. It does the following:
All computers with *firefox* that isn't version 220.127.116.11, that has a OS named %Workstation% and is in the OU Computers and has the SCCM Client installed.
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_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId
where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName like "%Firefox%" and SMS_G_System_ADD_REMOVE_PROGRAMS.Version != "18.104.22.168")
and SMS_R_System.OperatingSystemNameandVersion like "%workstation%"
and SMS_R_System.SystemOUName like "DOMAIN.int/Computers"
and SMS_R_System.Client = 1
This only works for 32bit software. If you want 64bit you need to use SMS_G_System_ADD_REMOVE_PROGRAMS_64 instead. If you want to do it on GUID use SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID