PowerShell by Riley

Invoke-WebRequest PowerShell Cmdlet

The Invoke-WebRequest PowerShell cmdlet is used to fetch content from a web page on the internet. It allows you to make HTTP requests, retrieve HTML content, and interact with web APIs directly from your PowerShell script.

Gets content from a web page on the internet.

# Here we are asking Google about PowerShell and saving the response
$Response = Invoke-WebRequest -URI https://www.google.com/search?q=powershell

# We use the Content property of $Response to access the webpage content
$Response.Content

In the example above, $Response will store the content retrieved from the specified URL (https://www.google.com/search?q=powershell). You can then use $Response to parse and extract information from the web page as needed.

To learn more about Invoke-WebRequest, you can visit the Microsoft documentation page. This resource provides detailed information and examples to help you understand and use this cmdlet effectively.

Comments