Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$CollectionName = "Duplicate Host Names"
New-CMDeviceCollection -Name "$CollectionName" -LimitingCollectionName "All Systems" -RefreshType Continuous
Add-CMDeviceCollectionQueryMembershipRule -CollectionName "$CollectionName" -QueryExpression "select R.ResourceID,R.ResourceType,R.Name,R.SMSUniqueIdentifier, R.ResourceDomainORWorkgroup,R.Client from SMS_R_System as r full join SMS_R_System as s1 on s1.ResourceId = r.ResourceId full join SMS_R_System as s2 on s2.Name = s1.Name where s1.Name = s2.Name and s1.ResourceId != s2.ResourceId" -RuleName "Duplicate Host Names"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.