Wednesday, October 8, 2008

Exclusions based on a Group or OU

All the computers that are only in the A and not the A & B?
Computer 1 Group A
Computer 2 Group B
Computer 3 Group A+B
Computer 4 Group A+B

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 on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Name not in (select distinct SMS_G_System_COMPUTER_SYSTEM.Name from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_R_System.SystemOUName = "Group B" ) and SMS_R_System.SystemOUName = "Group A"

Cross link on my blog to other exclusions

http://sms-hints-tricks.blogspot.com/2007/10/excluding-computers-from-collection.html