Skip to content

Instantly share code, notes, and snippets.

@riezebosch
Last active October 22, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riezebosch/cc165872280e2506c5c6 to your computer and use it in GitHub Desktop.
Save riezebosch/cc165872280e2506c5c6 to your computer and use it in GitHub Desktop.
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