Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save JeremyNevill/b288a18c0ceabc48dc553f18fa992b30 to your computer and use it in GitHub Desktop.

Select an option

Save JeremyNevill/b288a18c0ceabc48dc553f18fa992b30 to your computer and use it in GitHub Desktop.
AutoInstallAndRegisterVSTSAgent2017.ps1
$VSTSAgentFileName="vsts-agent-win7-x64-2.105.7.zip"
$VSTSAgentDownloadUrl="http://yourvstsagentdownloadserver/" + $VSTSAgentFileName
$TempFolder="c:/Temp/"
$VSTSAgentDownloadPath=$TempFolder + $VSTSAgentFileName
$VSTSAgentFolder="c:/vsts_agent"
$TFSServerUrl="http://yourtfsserver:8080/tfs"
function Download-VSTSAgent{
Write-Host("Downloading: " + $VSTSAgentDownloadUrl)
Write-Host("To: " + $VSTSAgentDownloadPath)
$WebClient = new-object System.Net.WebClient
$WebClient.DownloadFile($VSTSAgentDownloadUrl, $VSTSAgentDownloadPath)
}
function Unzip-VSTSAgent{
Write-Host("Unzipping: " + $VSTSAgentDownloadPath)
Write-Host("To: " + $VSTSAgentFolder)
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::ExtractToDirectory($VSTSAgentDownloadPath, $VSTSAgentFolder)
}
function Register-VSTSAgent{
cd $VSTSAgentFolder
& .\config.cmd --unattended --auth Negotiate --username yourdomain\yourusername --password yourpw --url $TFSServerUrl --pool yourpool
}
Download-VSTSAgent
Unzip-VSTSAgent
Register-VSTSAgent
@JeremyNevill
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment