Friday, November 15, 2019

Powershell Script to create Multiple AD group Collections

#Give the Ad group names in the CSV file


$Collections = Import-Csv  -Path "C:\SCCM_Scripts\adgroupcollectionslists.csv"

foreach ($col in $collections )
{
$Schedule = New-CMSchedule -Start "01/01/2019 12:00 AM" -DurationInterval Minutes -DurationCount 0 -IsUtc:$False -Nonrecurring

$col.Name

$query = "select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.SystemGroupName = 'Domain\\$($col.Name)'"

#Change the domain name in the above line

New-CMDeviceCollection -Name $col.Name -LimitingCollectionId 'SMS00001' -RefreshType None -RefreshSchedule $Schedule | Out-Null

Add-CMDeviceCollectionQueryMembershipRule -CollectionName $col.Name -QueryExpression $query -RuleName $col.Name

}


SCCM Application Deployment Tool

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