When a new version of Winrar comes out, just change the winrar-x64-540.exe to the new value.
# Silent Install Winrar# http://www.winrar.com# Path for the workdir
$workdir ="c:\installer\"
# Check if work directory exists if not create itIf(Test-Path-Path $workdir -PathTypeContainer){Write-Host"$workdir already exists"-ForegroundColorRed}
ELSE
{New-Item-Path $workdir -ItemType directory }# Download the installer
$source ="http://rarlab.com/rar/winrar-x64-540.exe"
$destination ="$workdir\winrar.exe"Invoke-WebRequest $source -OutFile $destination
# Start the installationStart-Process-FilePath"$workdir\winrar.exe"-ArgumentList"/S"# Wait XX Seconds for the installation to finishStart-Sleep-s 35# Remove the installer
rm -Force $workdir\w*
I made a install script for Winrar to do a Silent install.
UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists
Improvements are welcome!
When a new version of Winrar comes out, just change the winrar-x64-540.exe to the new value.
For Windows 7 please change
To
Since Powershell in Windows 7 does not support the Invoke-WebRequest