Skip to content

Instantly share code, notes, and snippets.

@danieljoos
Last active February 16, 2021 07:45
Show Gist options
  • Save danieljoos/22b3319dfe60cb4348d747aebd674d35 to your computer and use it in GitHub Desktop.
Save danieljoos/22b3319dfe60cb4348d747aebd674d35 to your computer and use it in GitHub Desktop.
TeamViewer - Add large number of SSO exclusion entries from CSV
Install-Module TeamViewerPS
Connect-TeamViewerApi
# ----
function Split-Bulk {
param([int]$Size)
Begin { $bulk = New-Object System.Collections.ArrayList($Size) }
Process { $bulk.Add($_) | Out-Null; if ($bulk.Count -ge $Size) { ,$bulk.Clone(); $bulk.Clear() } }
End { if ($bulk.Count -gt 0) { ,$bulk } }
}
# ----
$domain = Get-TeamViewerSsoDomain | Where-Object { $_.Name -eq 'example.com' }
# ----
Import-Csv ./example.csv | `
Split-Bulk -Size 100 | `
ForEach-Object { `
"Adding bulk of size $($_.Count)"
Add-TeamViewerSsoExclusion -DomainId $domain -Email $_.Email
}
# ----
Get-TeamViewerSsoExclusion -Domain $domain | Measure-Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment