I am trying to run this function to enable the agents in bamboo
function Enable-Agent([array]$agents){
$agents | %{
write-host "enabling agent name: $_"
$id = Get-AgentId $_
write-host "agent id: $id"
$enableAgentUrl = $bambooServer + "/admin/agent/enableAgent.action?agentId=" + $id + "&" + $bambooAuthentication
$html = Invoke-WebRequest $enableAgentUrl
}
}
I get the following error:
Invoke-WebRequest : The remote server returned an error: (401) Unauthorized.
At C:\SVN_Working\development\projects\infrastructure\bamboo\trunk\common\power
shell\bambooAgentFunctions.ps1:118 char:17
+ $html = Invoke-WebRequest $enableAgentUrl
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
This works fine for one of my teammates. Just errors out for me. Am I missing any setting here? I am very new to Powershell. Appreciate any help here. Thanks,