Invoke-WebRequest

PowerShell’s curl/wget for HTTP.

Windowslow

Invoke-WebRequest performs HTTP requests and parses responses (status, headers, links, forms) — used for testing and file download.

Syntax

Invoke-WebRequest -Uri {url} [-OutFile {path}]

Example

Invoke-WebRequest -Uri https://example.com -OutFile page.html

Downloads the page to page.html; the returned object also exposes headers and links.

Options & flags

What each switch does. Toggle them in the builder below to assemble a command.

-Uri <https://target.tld>Target URL.
-OutFile <page.html>Save the response to a file.
-Method <POST>HTTP method.
-Headers <@{Authorization="Bearer x"}>Hashtable of headers.
-Body <@{u="a"}>Request body.
-UseBasicParsingAvoid the IE DOM parser (faster/headless).

Command builder

Tick options (and fill any values) to build a ready-to-copy command.

invoke-webrequest

Usage examples

Invoke-WebRequest -Uri https://t/file.exe -OutFile f.exe

Download a file.

(Invoke-WebRequest https://t).Links.Href

List all links on a page.

Advantages
  • Rich parsed response object
  • Download + scrape in one cmdlet
  • No external tools
Disadvantages
  • Slower than curl
  • Parsing can hang on odd content (-UseBasicParsing)
  • Windows-centric defaults
Tags
#windows#http#download

Official docs: Invoke-WebRequest

Related commands

Frequently asked questions

What is Invoke-WebRequest used for?
Invoke-WebRequest performs HTTP requests and parses responses (status, headers, links, forms) — used for testing and file download.
What is an example Invoke-WebRequest command?
A common example is: Invoke-WebRequest -Uri https://example.com -OutFile page.html — Downloads the page to page.html; the returned object also exposes headers and links.
Is Invoke-WebRequest part of a standard install?
Invoke-WebRequest runs on Windows. It is typically available by default.
What category of security tool is Invoke-WebRequest?
Invoke-WebRequest is a PowerShell tool with a low-risk profile when run against a live target.

Try recon tools live

Run real scans against a domain you control, stage by stage.

Open the lab →