Monday, May 14, 2018

Adding Single machine to multiple collection (Direct membership rule to the collection)

# Adding Single machine to multiple collection (Direct membership rule to the collection)

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

cd "$Sitecode`:"
Foreach ($Collection in $Collections)

{ "$Collection"; add-CMDeviceCollectionDirectMembershipRule -CollectionName $collection -ResourceId ((Get-CMDevice -name "WINDOWS7TESTMachine").ResourceID) }

#Test machine name WINDOWS7TEST which is being added to the collections list txt file.

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



SCCM Application Deployment Tool

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