In a previous post I’ve covered the process of setting up a Windows Server 2019 VM in VirtualBox. So I’ve figured that I should add one to cover Windows Server 2022 as well.
Prerequisites
- Oracle VirtualBox – I’m currently using version 6.1.40
- Windows Server 2022 evaluation ISO
- Sufficient drive space – In my example I’ll be creating two dynamically allocated virtual disks (C drive – 50GB, D drive – 40GB)
The host, aka my PC, is running Windows 11 build 22621.963, but the process is the same on Windows 10.
Creating the VM
This time, I’ll cover both the GUI way of creating the VM as well as the PowerShell steps in a single post.
If you want to go straight to the PowerShell steps click here.
Via the GUI
I create a new, blank VM.

Once the “Create Virtual Machine” window opens, I switch to “Expert Mode” so that I can configure the RAM and system drive in one go.

Afterwards, I specify the name of the VM, the directory in which its base folder should reside, the OS type and version. Since VirtualBox 6.1.40 doesn’t have “Windows Server 2022” as a version, I’ll pick “Windows Server 2019” instead.
I’ll also set the machine’s RAM to 8GB and opt to create a virtual hard disk now, and press “Create”.

In the “Create Virtual Hard Disk” window I just go with the defaults:
- File size – 50GB
- Hard disk file type – VDI
- Storage on physical disk – Dynamically allocated
And I click on “Create”.

At this point the VM is created, but there are a few more things I like to set up before I start installing the OS.
So right click on the VM and go to “Settings”

In the “Processor” tab of the “System” section, I set the number of CPUs to 4.

Now to add a second virtual disk drive – this will be the 40GB D drive.
I go into the “Storage” section, increase the SATA controller’s port count from 2 to 3 (as per VirtualBox recommendations) and press the “add hard disk” button.

In the “Hard Disk Creator” window I press the “Create” button.


Once the windows switches to expert mode, I set the size to 40GB, validate the file location matches with the VM’s base directory and leave the defaults selected for hard disk file type and storage on physical hard disk, and then click on “Create”.

Now, in the “Hard Disk Selector” window I select the newly created virtual hard disk and then click on “Choose”.

While I’m in the “Storage” section, I’ll also attach the Windows Server 2022 Evaluation ISO by selecting the optical drive, expanding the disk drop-down menu and clicking on “Choose a disk file…”.

This opens up a file explorer window in which I navigate to where the “Windows_SERVER_2022_EVAL_x64FRE_en-us.iso” file resides so that I can attach it to the VM’s optical drive.

Afterwards, I navigate to the Network section set the network as bridged so the VM is accessible from the rest of the LAN.

At this point I can click “Ok” in the settings window so that the changes are saved.
I then start the VM.

And proceed with the OS installation process.
Via PowerShell
I open PowerShell and, to make things easier, append VirtualBox’s installation directory to the PATH environment variable.
1 |
$Env:Path += ";C:\Program Files\Oracle\VirtualBox\" |
Since VirtualBox 6.1.40 doesn’t have “Windows Server 2022” as a version, I’ll search for the OS ID for Windows Server 2019 instead.
1 2 |
VBoxManage list ostypes | Select-String -Pattern "Windows" | Select-String -Pattern "2019" -Raw |

I then use that OS ID to create and register an empty VM.
1 |
VBoxManage createvm --name WinSrv2k22 --ostype Windows2019_64 --register |
Take note of the location of the VM’s settings file location since that directory will also be the VM’s base directory.

Afterwards add CPU cores, RAM, and VRAM. Set the graphics controller, and set the network type as bridged as well as specifying the name of the host’s NIC that will be used.
1 2 3 |
VBoxManage modifyvm WinSrv2k22 --cpus 4 --memory 8192 --vram 128 ` --graphicscontroller vboxsvga --nic1 bridged ` --bridgeadapter1 "Intel(R) Ethernet Controller I225-V" |
Add a SATA storage controller, specify the controller’s chipset, port count, and set it as boot-able.
1 2 |
VBoxManage storagectl WinSrv2k22 --name "SATA" --add sata ` --controller IntelAHCI --portcount 3 --bootable on |
Create the virtual disk file that will eventually become the C drive.
1 2 |
VBoxManage createhd --filename F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22.vdi ` --size 51200 --variant Standard |
Add a second virtual disk file (optional).
1 2 |
VBoxManage createhd --filename F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22_1.vdi ` --size 40960 --variant Standard |
Attach the two disks to the storage controller.
1 2 |
VBoxManage storageattach WinSrv2k22 --storagectl "SATA" --port 0 ` --device 0 --type hdd --medium F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22.vdi |
1 2 |
VBoxManage storageattach WinSrv2k22 --storagectl "SATA" --port 1 ` --device 0 --type hdd --medium F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22_1.vdi |
Now, I can attache the Windows Server 2019 Evaluation ISO.
1 2 3 |
VBoxManage storageattach WinSrv2k22 --storagectl "SATA" --port 2 --device 0 ` --type dvddrive ` --medium C:\Users\Vlad\Downloads\Windows_SERVER_2022_EVAL_x64FRE_en-us.iso |
And start the VM in order to proceed with the OS install process.
1 |
VBoxManage startvm WinSrv2k22 |
Installing Windows Server 2022
Once the VM boots, I can select the language and regional settings and click on “Next”

If this pops up, just check the “do not show this message again” box and click on “Capture”. Just remember to press right Ctrl whenever you want to move the mouse outside the VM window.

In the next prompt click “Install Now”

For this VM, I opt to install the Windows Server 2022 Standard Evaluation (Desktop Experience) version.

In the next window I read and accept the software license terms, and proceed with the installation process.
For installation type I click on “Custom”, because there’s really no previous version of the OS to upgrade from.

I then proceed with the partition configuration part.
First, I select the drive (Drive 0) that’s going to end up being the system drive, click on “New” and then “Apply” in order to create a new partition.

Click “Ok” on the prompt informing me about the creation of additional system partitions.
I then repeat the same steps for the second drive (Drive 1).
And now I select the partition (Drive 0 Partition 2) on which the OS should be installed and click on “Next” to begin the installation.

After the install process finishes, the VM reboots and a prompt to “press any key to boot from CD/DVD” appears, I just wait for the prompt to time-out since I want to boot directly in Windows.
Once the OS boots up, it asks to set up a password for the Administrator account.

I type a password, confirm it and press “Finish”.
At the logon screen I send the Ctrl+Alt+Del input to the VM. This can also be done with the right Ctrl+Del keys.

And log into Windows with the previously configured password.
At this point I can eject the installation media and mount the VBoxGuestAdditions disk. If it doesn’t show up in the drop down list, it is located in “C:\Program Files\Oracle\VirtualBox\”.

Once the disk is mounted, I navigate to it in File Explorer and proceed with the installation of the guest additions. Right click on “VBoxWindowsAdditions.exe” and run as admin, then just proceed through the install without making any changes. I reboot the VM when the install process prompts me.
After the VM reboots I enable the shared bidirectional clipboard.

One last and optional part – I run the following commands in admin PowerShell to rename the VM, but also make sure that the current network profile is set to private so that the firewall won’t block me if I try to connect to SQL Server or anything else that I might install later.
1 2 3 |
Rename-Computer WinSrv2k22 get-netconnectionprofile | Select -ExpandProperty name | %{ set-netconnectionprofile -name $_ -networkcategory "private" } |

Leave a Reply