This is for SP1, but can be used with R2 as well, if you take out the x64 check in the script: http://www.david-obrien.net/2013/02/24/remove-direct-membership-rules-configmgr/
Sent from my Windows Phone ________________________________ From: Poole, Richard<mailto:[email protected]> Sent: 11/06/2014 6:19 AM To: [email protected]<mailto:[email protected]> Subject: [mssms] RE: Get-CMDeviceCollectionDirectMembershipRule Thanks, that worked quite well! Was trying to get a list from one collection to remove properly remove from another. A simple thing in the GUI but decided to try my hand at getting used to using Powershell to do this kind of administration. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Krueger, Jeff Sent: Tuesday, June 10, 2014 11:00 AM To: [email protected] Subject: [mssms] RE: Get-CMDeviceCollectionDirectMembershipRule Yeah not sure exactly what they want with the ResourceID parameter. If you just want a listing of the membership rules you could do something like $a = Get-CMDeviceCollection -Name "Your collection name" $a.CollectionRules $a.CollectionRules | Select RuleName (will give just the rule name which for direct memberships are the machine name) $a.CollectionRules.Count (will give you a count of all rules) To watch for direct membership counts I wrote a report that give a count of direct membership rules in collections and the count of the memberships since there can be rules that won't have a member show up due to the limiting collection SELECT dbo.v_Collection.CollectionID, dbo.v_Collection.Name, dbo.v_Collection.MemberCount, Count(*) As 'Direct Member Rule Count' FROM dbo.v_CollectionRuleDirect INNER JOIN dbo.v_Collection ON dbo.v_CollectionRuleDirect.CollectionID = dbo.v_Collection.CollectionID Group by dbo.v_Collection.CollectionID, dbo.v_Collection.Name, dbo.v_Collection.MemberCount -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Poole, Richard Sent: Tuesday, June 10, 2014 1:33 PM To: [email protected] Subject: [mssms] Get-CMDeviceCollectionDirectMembershipRule Hello everyone, I'm trying to get my toes wet with using the cmdlets for SCCM 2012 R2, but am running into a roadblock that I'm not sure is entirely of my own doing. According to the example for the command, I'm using the following line: Get-CMDeviceCollectionDirectMembershipRule -CollectionName "Servers - All SCCM servers" -ResourceId "" Except I continue to get a blank return from this, or on any other collection I specify. All having quite a number of direct rules. Anyone else experiencing this problem? Thanks, Richard Poole ________________________________ CONFIDENTIALITY NOTICE: This email contains information from the sender that may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected from disclosure. This email is intended for use only by the person or entity to whom it is addressed. If you are not the intended recipient, any use, disclosure, copying, distribution, printing, or any action taken in reliance on the contents of this email, is strictly prohibited. If you received this email in error, please contact the sending party by reply email, delete the email from your computer system and shred any paper copies. Note to Patients: There are a number of risks you should consider before using e-mail to communicate with us. See our Privacy & Security page on www.henryford.com for more detailed information as well as information concerning MyChart, our new patient portal. If you do not believe that our policy gives you the privacy and security protection you need, do not send e-mail or Internet communications to us.

