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

  1. Oracle VirtualBox – I’m currently using version 6.1.40
  2. Windows Server 2022 evaluation ISO
  3. 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.

Oracle VirtualBox GUI with the "New" button marked.

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.

Window
Create Virtual Machine
Name and operating system
Please choose a descriptive name and destination folder for the new virtual
machine and select type of operating system you intend to install on it.
The name you choose be used throughout VirtualBox to identify this
machine.
Name: 
Machine Folder: F:\VirtualBoxVMs
Type: Microsoft Windows
Version: Windows 7 (64-bit)

Buttons:
Expert Mode
Next
Cancel
Marked button:
Expert Mode

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”.

Window:
Create Virtual Machine
Name and operating system
Name: WinSrv2k22
Machine Folder: F:\VirtualBoxVMs
Type: Microsoft Windows
Version: Windows 2019 (64-bit)

Memory size: 8192 MB

Hard disk
O Do not add a virtual hard disk
X Create a virtual hard disk now
O use an existing virtual hard disk file

Buttons:
Guided Mode
Create
Cancel

Marked button:
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”.

Window:
Create Virtual Hard Disk
File location:
F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22.vdi
File size: 50.00 GB
Hard disk file type:
X VDI (VirtualBox Disk Image)
O VHD (Virtual Hard Disk)
O VMDK (Virtual Machine Disk)
O HDD (Parallels Hard Disk)
O QCOW (QEMU Copy-On-Write)
O QED (QEMU enhanced disk)

Storage on physical hard disk:
X Dynamically allocated
O Fixed size
O Split into files of less than 2GB

Buttons:
Guided Mode
Create
Cancel

Marked button:
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.

Window:
WinSrv2k22 - Settings
Section: System
Tab: 
Processor
Processor(s): 4 CPUs

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.

Window:
WinSrv2k22 - Settings
Section:
Storage

Storage Devices (in the center of the window)
Controller: SATA
Buttons (right next to the Controller: SATA label):
"Add Optical Drive", "Add hard disk"
Storage devices (continued)
WinSrv2k22.vdi (this is the HDD)
Empty (this is the optical drive)
Attributes (on the right hand side of the window)
Name: SATA
Type: AHCI
Port Count: 3
O Use Host I/O cache (unchecked)

Tool tip while hovering over the "Port Count" field"
Selects the port count of the SATA storage controller currently
selected in the Storage Tree. This must be at least one more than
the highest port number you need to use.

Marked buttons and fields:
Port Count: 3
The "Add hard disk" button

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

Window:
WinSrv2k22 - Hard Disk Selector
Medium
Buttons:
Add Create Refresh
Marked button:
Create
In the “Create Virtual Hard Disk” window I press the
Window:
Create Virtual Hard Disk
Hard disk file type
Please choose the type of file that you would like to use for the new virtual hard disk. If you do not
need to use it with other virtualization software you can leave this setting unchanged.
X VDI (VirtualBox Disk Image)
O VHD (Virtual Hard Disk)
O VMDK (Virtual Machine Disk)
Buttons:
Expert Mode, Next, Cancel
Marked Button:
Expert Mode

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”.

Window:
Create Virtual Hard Disk
File location:
F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22_1.vdi
File size: 40.00 GB
Hard disk file type:
X VDI (VirtualBox Disk Image)
O VHD (Virtual Hard Disk)
O VMDK (Virtual Machine Disk)
O HDD (Parallels Hard Disk)
O QCOW (QEMU Copy-on-write)
O QED (QEMU enhanced disk)

Storage on physical hard disk:
X Dynamically allocated
O Fixed size
O Split into files of less than 2G8 (grayed out)

Buttons:
Guided Mode, Create, Cancel
Marked Button:
Create

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

Window:
WinSrv2k22 - Hard Disk Selector
Medium
Buttons:
Add, Create, Refresh

The "Not attached" list is expanded and only contains one element - the new hard disk

Not Attached
 Name: WinSrv2k22_1.vdi Virtual Size: 40.00 GB Actual Size: 2.00 MB - selected

Buttons:
Choose, Cancel
Marked Button:
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…”.

Window:
WinSrv2k22 - Settings
Section: Storage
Storage Devices
Controller: SATA
WinSrv2k22.vdi
Empty (disk drive selected in the screenshot)
Attributes:
Optical Drive:
SATA Port 1
Clicked on the disk drive icon next to the, menu expands to show the second option "Choose a disk file" selected

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.

Window:
WinSrv2k22 - Settings
Section: Storage
Storage Devices
Controller: SATA
WinSrv2k22.vdi (virtual hdd)
Windows_SERVER_2022_EVAL_x64FRE_en-us.iso (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.

Window:
WinSrv2k22 - Settings
Section:
Network
Adapter 1 
X Enable Network Adapter
Attached to: Bridged Adapter
Name: Intel(R) Ethernet Controller 1225-V

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.

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.

PowerShell 7.3.1
PS C:\Users\Vlad> $Env:Path += ";C:\Program Files\Oracle\VirtualBox\"
PS C:\Users\Vlad> VBoxManage list ostypes | Select-String -Pattern "Windows" |
>>  Select-String -Pattern "2019" -Raw
ID:          Windows2019_64
Description: Windows 2019 (64-bit)

I then use that OS ID to create and register an empty VM.

Take note of the location of the VM’s settings file location since that directory will also be the VM’s base directory.

PS C:\Users\Vlad> VBoxManage createvm --name WinSrv2k22 --ostype Windows2019_64 --register
Virtual machine 'WinSrv2k22' is created and registered.
UUID: ca47396b-5b91-4d6e-8246-c5dc550b2b15
Settings file: 'F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22.vbox'

Marked text:
'F:\VirtualBoxVMs\WinSrv2k22\WinSrv2k22.vbox'

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.

Add a SATA storage controller, specify the controller’s chipset, port count, and set it as boot-able.

Create the virtual disk file that will eventually become the C drive.

Add a second virtual disk file (optional).

Attach the two disks to the storage controller.

Now, I can attache the Windows Server 2019 Evaluation ISO.

And start the VM in order to proceed with the OS install process.

Installing Windows Server 2022

Once the VM boots, I can select the language and regional settings and click on “Next”

Window:
Microsoft Server Operating System Setup
Microsoft
Language to install: English (United States)
Time and currency format: English (United States)
Keyboard or input method: US
Enter your language and other preferences and click " Next" to continue.
Button:
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.

VirtualBox - Information
You have clicked the mouse inside the Virtual Machine display or pressed
fre host key. This will cause the Virtual Machine to capture the host mouse
pointer (only if the mouse pointer integration is not currently supported by
fre guest OS) and the keyboard, which will make them unavailable to other
applications running on your host machine.
You can press fre host key at any time to uncapture the keyboard and
mouse (If it is captured) and return them to normal operation. The currentiy
assigned host key is shown on the status bar at the bottom of the Virtual
Machine window, next to the icon. This icon, together with the mouse
icon placed nearby, indicate the current keyboard and mouse capture state.
The host key is currently defined as Right Ctrl.
x Do not show this message again
Buttons:
Capture, Cancel
Marked Button:
Capture

In the next prompt click “Install Now”

Prompt with "Install now" button in the center of the screen.

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

Window:
Microsoft Server Operating System Setup
Select the operating system you want to install
Operating system; Architecture; Date modified
Windows Server 2022 Standard Evaluation; 64; 3/3/2022
Windows Server 2022 Standard Evaluation (Desktop Experience); 64; 3/3/2022 - selected
Windows Server 2022 Datacenter Evaluation; 64; 3/3/2022
Windows Server 2022 Datacenter Evaluation (Desktop Experience); 64; 3/3/2022

Buttons:
Next
Marked Button:
Next

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.

In the VM window, in the top bar, click on Input > Keyboard > Insert Ctrl-Alt-Del

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.