Share via


Windows 10 Internet Options ~ Powershell Invoke-WebRequest “Windows Security Warning”

Question

Friday, July 31, 2015 4:47 AM

(This issue has been also posted on stackexchange under the same name where images can be found...)

Alright this is one big problem in my opinion that Microsoft needs to address immediately. Steps to reproduce this:

powershell> Invoke-WebRequest "anywebsitewithcookies.com" (Let's do microsoft.com for example)

What happens is that you get the following warning: 
"To Allow this website to provide information personalized for you, will you allow it to put a small file (cookie) on your computer?"

Now this is just horrible. Why Microsoft thinks this is acceptable is beyond me, however in Windows 8.1 there was a workaround. If you went into:

Control Panel > Internet Options > Privacy, there was a slider you could turn all the way down to allow ALL cookies.

You could set cookies to be accepted all the time. This was the only way to get rid of this message and still retain DOM parsing functionality. -UseBasicParsing isn't a solution for me, because I want to use the functionality of what Invoke-WebRequest returns without basic parsing.

However now in Windows 10 Microsoft decided to get rid of this slider for whatever reason.

This problem can be reproduced on every Windows 10 machine and completely destroys how Invoke-WebRequest can be used in a silent scripting environment, because the script hangs and waits for the dialog to be answered. Is there a way to still set Cookies to be accepted for all like in 8.1? I tried every setting in Internet Options in Windows 10, but nothing holds the key. I believe they stopped using it and perhaps moved that setting elsewhere, but I can't find it. Microsoft Edge doesn't have many settings either, so none of them were helpful.

This is just infuriating. Any help would be highly appreciated, as this will create quite a chaos in many environments.

All replies (2)

Sunday, August 2, 2015 7:16 AM ✅Answered

Hi John,

Based on my test, yes, it's indeed like what you said even set all settings as "allow cookies".

So far, please user "-usebasicparsing" option as a workaround. And then please submit this feedback via the built-in Feedback App.

Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].


Thursday, November 12, 2015 6:03 PM | 1 vote

Hi --

Forgive me, Karen, but why do you think -usebasicparsing will be of any help?

On a Windows 10 system, try

iwr www.stackoverflow.com -SessionVariable news -UseBasicParsing

And your system will hang.

Try this workaround instead:

reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /t REG_DWORD /v 1A10 /f /d 0

Then close your PowerShell session, re-open it, and try

iwr www.stackoverflow.com -SessionVariable news

Now it'll work.  Not an ANSWER, but a workaround.  I hope this helps!