AF
Size: a a a
AF
A
AS
A
A
AF
AF
A
R
A
\
\
AS
AS
AS
\
SK
$BatchBy = 100
$CurrentStep = 0
$Names = "a*"
$CollName = "Test collection"
$AllResourceID = (Get-CMDevice -Name $Names -Fast).ResourceId
while ($CurrentStep -lt $AllResourceID.Count) {
$Batch = @($AllResourceID | Select-Object -First $BatchBy -Skip $CurrentStep)
Add-CMDeviceCollectionDirectMembershipRule -CollectionName $CollName -ResourceId $Batch
$CurrentStep += $BatchBy
}
AF
SK
$BatchBy = 100
$CurrentStep = 0
$Names = "a*"
$CollName = "Test collection"
$AllResourceID = (Get-CMDevice -Name $Names -Fast).ResourceId
while ($CurrentStep -lt $AllResourceID.Count) {
$Batch = @($AllResourceID | Select-Object -First $BatchBy -Skip $CurrentStep)
Add-CMDeviceCollectionDirectMembershipRule -CollectionName $CollName -ResourceId $Batch
$CurrentStep += $BatchBy
}
$VerbosePreference = 'Continue'
$array = @((1..20) | % { "Item$($_)"})
$BatchBy = 5
for ($i=0; $i -lt $array.count; $i += $BatchBy) {
Write-Verbose "new batch.."
$array[$i..($i+$BatchBy-1)]
}
Х