none
Invoke-WebRequest - Time Out - Run As Different User RRS feed

  • Question

  • Hello,

    I have been trying to test a URL via powershell using 'Invoke-WebRequest' command.

    It is working fine with my OS account - I'm getting the response but when I try the same in powershell with different user (service id) the request is getting timed out.

    Steps:

    1. Open powershell with "Run as different user"

    2. Give the credentials

    3. Execute "Invoke-WebRequest" command

    Error:

    Invoke-WebRequest : The operation has timed out.
    At line:1 char:1
    + Invoke-WebRequest  -URI https://<URL>
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
       eption
        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

    Your valuable inputs will be helpful. Thank you.

    Regards,

    Palaniappan

     

    Tuesday, December 24, 2019 11:58 AM

All replies

  • I try the same in powershell with different user (service id) the request is getting timed out.


    This looks like a web authentication problem, not a scripting question.

    You are leaving out a lot of important information. Is this a public web site? Is it accessed through a proxy server? Is it a local site on your private network?  Does Invoke-WebRequest work for other sites when run as this service id? Are there workstation logon restrictions on this account in Active Directory?  Do you have access to the web server and if so have you reviewed the security eventlog to see that the account successfully authenticated? If you do not have access to web server have you contacted that server's support team and have them examine the IIS/security logs? 

    Tuesday, December 24, 2019 2:24 PM