The collections list the computers with that installed application. This was used to remove obsolete programs, verify licenses, and generally clean up the devices. The SQL query and scripts for these three scenarios are at the end of this article. But first, the main script! SCCM PowerShell Script to Create Device Collections from a CSV When this program is removed, the other missing programs in Add/Remove Programs are listed again. Run the Uninstall Program Included in the Uninstall Folder Some programs create a folder under the Winnt folder that contains a "$" character at the start and end of the folder name. Apr 19, 2016 · You can then use this information to populate device collections through WQL queries of information in the ConfigMgr database. Right Click Device Collections and click Create Device Collection. Enter a logical name for the Collection. Click Add Rule and select Query Rule. Click Edit Query Statement. Inventory that comes from the client add and remove programs is stored in 2 locations in WMI SMS_G_System_ADD_REMOVE_PROGRAMS and SMS_G_System_ADD_REMOVE_PROGRAMS_64. You will have to query one of these as per the needs.