On a Windows server with Internet Explorer Enhanced Security Configuration enabled, calling Invoke-WebRequest like this:
Invoke-WebRequest "http://localhost" -UseBasicParsing -UseDefaultCredentials
Results in this error dialog:
Considering that this script is intended to be run remotely, I'd like to avoid the dialog appearing at all.
It seems Invoke-WebRequest requires IE unless you specify -UseBasicParsing parameter. see: https://msdn.microsoft.com/powershell/reference/5.1/microsoft.powershell.utility/Invoke-WebRequest
-UseBasicParsing Indicates that the cmdlet uses the response object for HTML content without Document Object Model (DOM) parsing.
This parameter is required when Internet Explorer is not installed on the computers, such as on a Server Core installation of a Windows Server operating system.
Perhaps systems have changed since Raf's answer above was posted. I found it didn't work for me.
What did work was:-
Click Add and add about:security_powershell.exe
to Trusted Sites
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With