PowerShell Tip of the Week: Create Invoke-WebRequest from Chrome

This week PowerShell tip will show you how to create Invoke-WebRequest from Chrome.

Each scripter who wanted to properly use Invoke-WebRequest command to access some url knows that it is not so easy.
Every time headers or some additional settings must be adjusted to properly gather all the data.
Last update of Chrome web browser gives awesome functionality for PowerShell developers.
In Chrome Dev Tools option to copy whole Invoke-WebRequest command has been added. Now to access specific url from PowerShell you need only copy it from Dev Tools!

How to do it?

1. Open Chrome Web Browser and navigate to url you want to access from PowerShell.
2. Open Chrome Dev Tools (Ctrl+Shift+I) and navigate to Network tab

3. Right click on the url you want to access Copy and click Copy as Powershell.

4. In your clipboard you have whole Invoke-WebRequest command which can be used in your script without any adjustment 🙂

I hope it will be usefull for some of you 😉
Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.