1

Say I have a Collection for installing Java for 2k computers, and I'd like to check the compliance, not for all computers, but for a list of specified computers (say 500 computers in a .txt).

How can I do that?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Kalenus
  • 21
  • 1

1 Answers1

0

You can of course deploy a compliance baseline on any collection, so the basic question here is how to add arbitrary computers from a list to a collection.

The easiest solution is probably using powershell. Open up your SCCM Console, click in the upper left and choose: "Connect via Windows Powershell"

This does the same as manually opening a PS window, Importing the Module ConfigurationManager.psd1 from the "bin" subfolder of the SCCM Console installation and changing to the PSDrive to the SCCM site using "cd :

from there you can add a direct membership using:

Add-CMDeviceCollectionDirectMembershipRule -CollectionId <collectionid> -ResourceId <resourceid>

So to add a whole list of computers you can just use

$Computers = get-content C:\computers.txt
Foreach ($Computer in $Computers) { 
   add-cmdevicecollectiondirectmembershiprule -CollectionId <collectionid> -resourceid (Get-CMDevice -name $Computer).ResourceID 
}

If the computer is already a direct member of your collection you will get an error, but the powershell will continue to run, so it's not an issue.

Syberdoor
  • 2,521
  • 1
  • 11
  • 14