Remote Invoke-WebRequest gets error

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
cgjackson@yahoo.com
Posts: 7
Joined: Wed Mar 01, 2017 12:54 pm

Remote Invoke-WebRequest gets error

Post by cgjackson@yahoo.com » Mon Jul 23, 2018 11:37 am

The script works on the remote box and with browser from the box I am remoting from.

The code is:
(Invoke-WebRequest https://xxxxxxxxx/$DateFrom).Content

Error is:
ERROR: The remote server returned an error: (404) Not Found.
ERROR: + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
ERROR: + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
ERROR: + PSComputerName : XXX
ERROR:

jvierra
Posts: 13889
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Remote Invoke-WebRequest gets error

Post by jvierra » Mon Jul 23, 2018 12:30 pm

THe error says that the page was not found. Try it without using the variable.

Locked