Monday, May 14, 2018

Adding multiple machines to single collection (Direct membership collection)

# Adding multiple machines to single collection (Direct membership collection)

$Sitecode = "SMS"
# add the site code 
$PathToSCCMModule = "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
Import-Module $PathToSCCMModule
$Computers = get-content "C:\users\USER_Name\Desktop\Testmachine.txt"

cd "$Sitecode`:"
Foreach ($Computer in $Computers)

{ Add-CMDeviceCollectionDirectMembershipRule -CollectionName "WIndows 7 collection" -ResourceId ((Get-CMDevice -name $Computer).ResourceID) }

#Collection name in yellow WIndows 7 collection



No comments:

Post a Comment

SCCM Application Deployment Tool

SCCM Application Deployment Tool Streamlining SCCM Application Deployments: Introducing the SCCM Application Deployment Tool. In the realm o...