Download Files With PowerShell

In this blog post,  I will show you to use PowerShell to download a file and save it on your computer using PowerShell.

Using PowerShell to download files can be very handy in cases where you need to download files as part of an automated task or if you don’t want to use the browser.

Invoke-Command

To download files with PowerShell we use the invoke-command cmdlet which can be a shortcut to wget.

Code

In the following example, I will use PowerShell to download a PowerShell script from GitHub and save under c:\devops.

wget -uri "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1" -OutFile C:\DevOps\EnableWinRM.ps1

Processing…
Success! You're on the list.

Leave a comment

Your email address will not be published.

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