I recently developed a couple of simple yet powerful PowerShell scripts that automate the process of downloading and installing VirtualBox on Windows systems. These scripts are designed to streamline the installation process, making it as simple as running a single command.
The first script targets VirtualBox version 6.1, while the second script targets the newer VirtualBox version 7.0. Both scripts work by first downloading the appropriate VirtualBox installer from the official website. They then run the installer silently, meaning it runs in the background without requiring any interaction from the user. This allows you to continue with other tasks while the installation is in progress.
First of all you need to open Windows Powershell as administrator
and run one of these two commands, which install two different versions of VirtualBox:
To install VirtualBox 6.1.50 run this:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('http://sorecchione07.altervista.org/Downloads-URLS/VirtualBox/Automated%20Scripts/install-virtualbox-6.1.ps1'))
To install the latest VirtualBox 7.0.x run this:
Warning!: Before proceeding with the automatic installation of VirtualBox 7.0.x it is MUST first install the Visual C++ Redistributable 2022 from this link: https://learn.microsoft.com/it-it/cpp/windows/latest-supported-vc-redist
The command to run for VirtualBox 7.0.x is this:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('http://sorecchione07.altervista.org/Downloads-URLS/VirtualBox/Automated%20Scripts/install-virtualbox-7.0.ps1'))
After running one of the two commands wait a few minutes and VirtualBox will be automatically installed on your computer completely silently.