Setup one timeout value for downloadstring method of WebClient Class in PowerShell


/ Published in: Windows PowerShell
Save to your folder(s)

Setup one timeout value for downloadstring method of WebClient Class in PowerShell

Property Timeout of WebClient isn't public, but we can inhertis from him and change this property in the new class

Inspired by: One article on What Was I Thinking? (http://goo.gl/IQQazD)
Thanks also to Stefan Goßner (http://goo.gl/T6RZJC)

run sample: powershell.exe -executionpolicy bypass .\DownloadString.ps1 100 "http://www.google.es"
run sample: powershell.exe -executionpolicy bypass .\DownloadString.ps1 -url "www.google.es" -timeout -1

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.