Invoke-RestMethod failure when using job scheduler in linux

Welcome Forums General PowerShell Q&A Invoke-RestMethod failure when using job scheduler in linux

Viewing 3 reply threads
  • Author
    Posts
    • #245187
      Participant
      Topics: 17
      Replies: 15
      Points: 87
      Rank: Member

      Does anyone know how pwsh and linux handles certificates when using HTTPS?   I’m running into an issue when utilizing Invoke-RestMethod through our job scheduler.   I do not get an error when I run it directly through the terminal.

       

      Error:

      Invoke-RestMethod : The remote certificate is invalid according to the validation procedure.

      At line:1 char:1

      + Invoke-RestMethod -uri ‘https://blogs.msdn.microsoft.com/powershell/f

      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      + CategoryInfo          : InvalidOperation: (Method: GET, Re…rShell/6.1.3

      }:HttpRequestMessage) [Invoke-RestMethod], HttpRequestException

      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

      EXIT STATUS VALUE OF $? THE COMMAND THROUGH POWERSHELL: 0

    • #245253
      Senior Moderator
      Topics: 9
      Replies: 1311
      Points: 4,794
      Helping Hand
      Rank: Community Hero

      Are you using PowerShell background Jobs ?

    • #245307
      Participant
      Topics: 17
      Replies: 15
      Points: 87
      Rank: Member

      Nope.   It’s executed from kornshell.

      pwsh -command “Invoke-RestMethod -uri ‘https://blogs.msdn.microsoft.com/powershell/feed/'”

    • #246081
      Participant
      Topics: 0
      Replies: 1
      Points: 5
      Rank: Member

      Probably something in your path variable is being changed.  Is anything being sourced when the scheduler runs?

Viewing 3 reply threads
  • You must be logged in to reply to this topic.