Image: iStockphoto/DragonImages

Introduced in PowerShell (PS) 3.0, the Microsoft version of Wget is supported as a core cmdlet in PS named Invoke-WebRequest. While not to be confused with the GNU version of Wget, which is also available as an installable application for Windows clients, the Invoke-WebRequest cmdlet may be called by simply launching PowerShell, typing in wget, and pressing the Enter key.

Invoke-WebRequest functions identically to Wget and serves the same purpose, as a non-interactive network downloader, or simply put: A command that allows a system to download files from anywhere on the web in the background without a user logged in.

SEE: 20 PowerShell cmdlets you can use instead of CMD commands (free PDF) (TechRepublic)

While I imagine no one is at all thrilled about navigating a website over the CLI, Invoke-WebRequest and similar utilities (hereby referred to collectively as Wget) were designed with more practical uses in mind—specifically, obtaining files over web-based protocols like HTTP, HTTPS, FTP, and SFTP, which could be used by admins to transfer data over networks and aid in testing services over the web. Wget was designed with varying network conditions in mind, thereby making it ideal for slow, unstable connections by including support for retrying and the ability for downloads to pick up where they left off.

Below are some examples of common uses for Wget.

Download a file over HTTP/S

Invoke-WebRequest -Uri -OutFile \path	olocalfile.ext

Transfer a file over S/FTP

$source = "" $destination = "C:directoryfile.ext" Invoke-WebRequest $source -OutFile $destination -Credential ftpuseraccount

Resuming a partial download

Invoke-WebRequest -Uri -Resume -OutFile \path	olocalfile.ext

Resolve shortened URLs

$Uri = 'short-url/extension' $Web = Invoke-WebRequest -Uri $Uri -UseBasicParsing $Web.BaseResponse.ResponseUri.AbsoluteUri

Scrape links from a website

(Invoke-WebRequest -Uri "").Links.Href

Request data from a website impersonating a browser

Invoke-WebRequest -Uri -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)

The examples above are just a few of the many possibilities available with the Invoke-WebRequest cmdlet found within PowerShell. There are multiple uses for the cmdlet that extend to DevOps, web, and application developers that allow them to thoroughly test for issues in APIs, databases, and web service platforms, and enable them to properly vet their products before taking them live, or to aid in troubleshooting issues should they arise.