chocolatey-community / chocolatey-packages-template

A template to use when setting up to create packages both manual and automatic
Apache License 2.0
83 stars 348 forks source link

[Tip] Invoke-WebRequest in AU update script #10

Closed AdmiringWorm closed 7 months ago

AdmiringWorm commented 8 years ago

Just came across this when I was creating some packages using AU.

If you are using Invoke-WebRequest in the AU update script, and one of the following happens:

If any of these happen ty changing Invoke-WebRequest to Invoke-WebRequest -UseBasicParsing

ferventcoder commented 8 years ago

Great tip!

ferventcoder commented 8 years ago

Definitely important for folks that don't want to open and configure Windows Internet Options as well

AdmiringWorm commented 8 years ago

So true, Personally I didn't even think of the posibility of configuring Windows Internet Options to get rid of the warning.

Also re-read the documentation of the cmdlet and found one piece of information I missed when reading it for the first time.

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.

ferventcoder commented 7 years ago

@majkinetor I think you may have already handled this one?

majkinetor commented 7 years ago

Yes, seems like a iwr bug reported by several people. Details:

Invoke-WebRequest can block the updater

ferventcoder commented 7 years ago

Is it bad to add the -UseBasicParsing to the default?

majkinetor commented 7 years ago

I don't know.

Some sites work with it, some without it. Its even machine dependent ?! On my local machine update runs, then on AV it doesn't. When I set it to run on AV, it doesn't run on my local machine.

Its not that relevant since you don't have to use it with AU, its just damn convenient.

ferventcoder commented 7 years ago

Basically if you have not opened Internet Explorer or it's options, you have to set -UseBasicParsing or IWR just doesn't work.

majkinetor commented 7 years ago

Thats strange and i doubt it. How my packages function then on AV? Also this behavior would make iwr not working on core.

majkinetor commented 7 years ago

I checked online docs and it never mentions this as far as I can see. Also, cookies are not saved by default, perhaps this behavior is only true when u use SessionVariable ?

TheCakeIsNaOH commented 7 months ago

Closing as this was previously added to the troubleshooting info in the wiki.