Skip to content

Instantly share code, notes, and snippets.

@frankfuu
Created May 10, 2018 00:45
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 frankfuu/d8f24884ec191fa6f703e4f6db1dcb7a to your computer and use it in GitHub Desktop.
Save frankfuu/d8f24884ec191fa6f703e4f6db1dcb7a to your computer and use it in GitHub Desktop.
Param(
[string]$pat,
[string]$url,
[string]$agentPrefix,
[string]$pool,
[string]$sourceDir,
[string]$tgtDirPrefix,
[int]$copies
)
## needs to run with Admin rights
foreach($n in 1..$copies)
{
$tgtDir = "$tgtDirPrefix-$n"
$agentName = "$agentPrefix-$n"
Copy-Item $sourceDir $tgtDir -Recurse
cd $tgtDir
Write-Host "Setting up $agentName"
.\config.cmd --unattended --url $url --auth pat --token $pat --runAsService --pool $pool --agent $agentName
cd ..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment