Download and Install Applications from the Web with Powershell

For various administrative purposes, it can be useful to download files and install via Powershell. There are a few ways to do it, but with Powershell 5.1, I’ll leverage invoke-webrequest and start-process.

In the example below, I’m downloading Windows Powershell for AWS installer, using /qn to install silently.


#create new directory for download...just because
new-item "C:\download" -type directory

#download file
invoke-webrequest "http://sdk-for-net.amazonwebservices.com/latest/AWSToolsAndSDKForNet.msi" -outfile "C:\download\AWSToolsAndSDKForNet.msi"

#run installer silently
start-process -filepath "C:\download\AWSToolsAndSDKForNet.msi" -ArgumentList "/qn"

As always, don’t forge to Run As Administrator.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s