Ever want to teach yourself Microsoft Powershell?
This Guide from MS Switzerland is an excellent First step. though it was written in 2007, It is Awesome, and the first thing I point people too when they want to learn Powershell.
It Gives an Excellent Foundation, that you can build on from there.
Grab A Copy Here (PDF)
For Additional PowerShell Resources, Check Out:
Tuesday, January 7, 2014
Powershell to Add / Remove a PC To SCCM Collection
This is one of those fun things. To Add a PC to the Collection MS makes you do it by Resource ID.
This means you need to lookup the Resource ID of the PC, which you can do by Name, before you dump it in.
This means you need to lookup the Resource ID of the PC, which you can do by Name, before you dump it in.
ADD:
$x="PCNAME";$collectionname="
Collection
";Add-CMDeviceCollectionDirectMembershipRule -CollectionName $collectionname -ResourceId $(get-cmdevice -Name $x).ResourceID
Removal is Simpler, as you simply need to specify the PC name and Collection name.
REMOVE:
Remove-CMDeviceCollectionDirectMembershipRule -CollectionName <String> -ResourceName <String> [-Force]
Subscribe to:
Posts (Atom)