Friday, July 11, 2014

Powershell Invoke-WebRequest to Jenkins

Scenario: Jenkins with authentication turned on and a user wanting to use Powershell to remotely execute a job

These 2 links provide most of the background and give examples for WGET. Jenkins authentication being managed by Crowd in this scenario

https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients


Invoke-WebRequest -Uri $url -Headers @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($User+":"+$Password ))}