Remote Invoke-WebRequest gets error

Ask your 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.
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
cgjackson@yahoo.com
Posts: 7
Last visit: Tue Aug 07, 2018 5:16 am

Remote Invoke-WebRequest gets error

Post by cgjackson@yahoo.com »

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Remote Invoke-WebRequest gets error

Post by jvierra »

THe error says that the page was not found. Try it without using the variable.
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked