VirtualBox sets the BIOS serial number of every VM instance to 0. It seems to be possible to change some BIOS settings, but I haven't seen anything that directly references the serial number.
Can anyone suggest a way to do this?
Really has detailed answer for this.
You can set the bios serial number by doing this:
VBoxManage setextradata "VM name" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "System Serial"
The error you were getting is caused by the serial not being set as a string value, if you have a pure number you should prepend it with
string: like so:
VBoxManage setextradata "VM name" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "string:1234"
Note: In case your VM is configured to use EFI firmware you need to replace pcbios by efi in the keys.
Not from any external settings. But you can from the code and then build it yourself:
Source file: DevPcBios.cpp
READCFGSTR("DmiSystemSerial", pszDmiSystemSerial, "0");
Change "0" to whatever value you need.
EDIT: You can apparently use VBoxManage setextradata. I have used it in the past for other type of configurations (not bios related) and didn't test this particular setting. Give it a go:
VBoxManage setextradata *YourVMName* VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial "*yourserial*"
Otherwise... revert back to source code editing and building.
Best of luck.
If you run that command, and get the error referenced by Roger, you need to back out the command by running the command without the last parameter (VALUE).
This removes the entry causing the error.
If you are unsure of what the last offending command was, open the ~~~.vbox (XML) file in the root of the VirtualMachines folder of the specific VM and review the EXTRADATA section.
Running the command-line call to vboxmanage is the best way to modify these. Editing the xml file does not stick 100% of the time.
The accepted answer didn't update the serial number correctly for me; instead, I followed these steps to successfully update the serial number. Note the guest OS was macOS and the host was windows.
NOTE: You must close virtualbox before running this command for it to be saved.
cd "C:\Program Files\Oracle\VirtualBox\"
VBoxManage.exe setextradata "VM NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "SERIAL_HERE"see source.*
VBoxManage.exe list vms.
Try using a serial number that contains 20 byte hexadecimal string:
VBoxManage setextradata "VM name" "VBoxInternal/Devices/ahci/0/Config/Port0/SerialNumber" "serial"