kaiserclaw Posted October 19, 2018 Report post Posted October 19, 2018 Hello, I use AD-groups when deploying applications and I want to create an automatic uninstall when the computer object is not included in the AD group (removed from the group). I created a collection and query that checks if the application is installed but the computer object is not included in the group. This is what I got so far: 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_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID like "{34624CAC-1434-468E-56DC-2A7D44D5F49F}" and SMS_R_System.SecurityGroupName != "MGT\\App-install-Adapt" It does not work properly - some computers are listed even though they are in the install AD-group. Thanks in advance Quote Share this post Link to post Share on other sites More sharing options...
GarthMJ Posted October 19, 2018 Report post Posted October 19, 2018 6 hours ago, kaiserclaw said: This is what I got so far: 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_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID like "{34624CAC-1434-468E-56DC-2A7D44D5F49F}" and SMS_R_System.SecurityGroupName != "MGT\\App-install-Adapt" You will need to use a sub-select query to do the not in stuff. Here is an example. https://www.enhansoft.com/blog/subselect-wql-query-to-find-pcs-that-do-not-have-either-x86-or-x64-versions-of-software-installed 1 Quote Share this post Link to post Share on other sites More sharing options...
kaiserclaw Posted October 22, 2018 Report post Posted October 22, 2018 On 10/19/2018 at 5:36 PM, GarthMJ said: You will need to use a sub-select query to do the not in stuff. Here is an example. https://www.enhansoft.com/blog/subselect-wql-query-to-find-pcs-that-do-not-have-either-x86-or-x64-versions-of-software-installed Thank you! Quote Share this post Link to post Share on other sites More sharing options...