Following script will loop through all Partner Center customers, will export them in batches of 100 and every “chunk” will be exported to separate CSV file.
$custIDs = Get-PartnerCustomer $chunks = [System.Collections.ArrayList]::new() for ($i = 0; $i -lt $custIDs.Count; $i += 100) { if (($custIDs.Count - $i) -gt 99 ) { $chunks.add($custIDs[$i..($i + 99)]) } else { $chunks.add($custIDs[$i..($custIDs.Count - 1)]) } } $today = [datetime]::Today.ToString("yyyy-MM-dd") $count = 1 foreach ($chunk in $chunks) { $path = "c:\Reports\$today Chunk $count of $($chunks.Count).csv" $chunk | Export-Csv $path -Append $count++ }
Nice tip! Thanks for sharing.
LikeLike