$collectionname="Exclude Reader DC" foreach ($x in gc C:\temp\adobe.txt){ $y=get-qaduser $x $user="DOMAIN\"+$y.samaccountname $z=Get-CMUserDeviceAffinity -UserName $user #$q=Get-CMDevice -ResourceId $z.resourceid #$q.name $z.resourceid Add-CMDeviceCollectionDirectMembershipRule -CollectionName $collectionname -ResourceId $z.resourceid }
Tuesday, October 27, 2015
Adding Users Devices to a Collection by First and Last Name
Recently I was given a Set of User's Names to exclude from a deployment. Easy. Until I realized the deployment was deployed to devices, not users.
I dropped the user list into a text file. First Last, each on its own line. I read the file and grabbed the username, then performed a User Device affinity check, throwing the associated computer into the exclusion collection.
Labels:
Powershell,
SCCM 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment