Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

$
0
0

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,


Viewing all articles
Browse latest Browse all 6937

Trending Articles