Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Alle cursist computers in cursuslokaal
function ForEach-Computer([int] $from, [int] $to, [ScriptBlock] $script) {
for ($i=$from; $i -le $to; $i++) {
$computername = "$($env:COMPUTERNAME -replace "DOCENT(?=.)", "CURSIST")$($i.ToString("00"))"
Write-Host $computername
Invoke-Command $script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.