Unattended install of Oracle VirtualBox using PowerShell
1 min readJun 13, 2020
I’m currently writing lots of building blocks of code to deploy Infrastructure as Code (IaC).
Here is a simple PowerShell script to download and deploy Oracle VirtualBox for Windows in unattended mode using PowerShell.
Download and Install Oracle VirtualBox for Windows
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
$vBoxURL = "https://download.virtualbox.org/virtualbox";
Invoke-WebRequest -Uri "$vBoxURL/LATEST-STABLE.TXT" -OutFile "$env:TEMP\virtualbox-version.txt";
$version = ([IO.File]::ReadAllText("$env:TEMP\virtualbox-version.txt")).trim();
$vBoxList = Invoke-WebRequest "$vBoxURL/$version";
$vBoxVersion =$vBoxList.Links.innerHTML;
$vBoxFile = $vBoxVersion | select-string -Pattern "-win.exe";
$vBoxFileURL = "$vBoxURL/$version/$vBoxFile";
Invoke-WebRequest -Uri $vBoxFileURL -OutFile "$env:TEMP\$vBoxFile";
start-process ("$env:TEMP\$vBoxFile") --silent;
And that’s all folks. If you liked this story, please show your support by 👏 this story. Thank you for reading!