Question

I am looking for a script in powershell or vb that will check the current PC to verify that it is a member of a specified SCCM 2012 collection.

We want to do this so we can create multiple deployment types and assign them to different collections, then use the deployment type requirements to make sure those deployment types only deploy to the correct collection. We do not want to create multiple applications for the same media when there are only slight variations in the installation parameters.

I believe there should be a basic script to check if current PC is a member of collection DR100038 (as an example) and return a 1 or 0.

No correct solution

OTHER TIPS

with a colleague, we had luck with the following (Powershell and WMI inside), SCCM not providing at the moment the right commandlets :

  • for your device, get the ID:

    $DeviceID=(Get-WmiObject -ComputerName -Namespace root\sms\ -class SMS_R_System -filter "Name=''").ResourceID

  • search to which collections it is linked :

    Get-WmiObject -ComputerName -Namespace root\sms\ -class SMS_CollectionMember_a -filter "ResourceID='$DeviceID'"

  • filter the resulting list

I found that solution, digging in https://skydrive.live.com/?cid=030BC1EA09F784F6&id=30BC1EA09F784F6!213&sc=documents#cid=030BC1EA09F784F6&id=30BC1EA09F784F6!222&sc=documents, especially Query_PC_Collection_Membership.ps1 (kudos to Kaido).

Enjoy,

PN9

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top