locked
invoke-webrequest parameters not supported RRS feed

  • Question

  • I am using Powershell

    ====

    PS H:\> $PSVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      5.1.17134.407
    PSEdition                      Desktop
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   10.0.17134.407
    CLRVersion                     4.0.30319.42000
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1

    =====

    When I invoke the following command ( ip redacted)

     invoke-webrequest www.xxx.yyy.zzz -MaximumRetryCount 2

    I get the following error:

    Invoke-WebRequest : A parameter cannot be found that matches parameter name 'MaximumRetryCount

    ====

    It is important that I be able to specify a timeout because one of the tests "succeeds" after 3 minutes, Browsers don't wait that long.

    Please advise.

    Boyd


    BDM

    Wednesday, December 12, 2018 2:48 PM

Answers

  • Instead of Maximumretrycount parameter you should use TimeoutSec  parameter.

    There is actually difference between Retrycount and TimeoutSec. What you want to do as per the details, you want to increase the Timeout time not the retry count.

    • Marked as answer by Boyd1 Wednesday, December 12, 2018 3:03 PM
    Wednesday, December 12, 2018 3:00 PM