Windows bcdedit and you

bcdedit is a super-powerful console tool for managing Windows Boot Configuration Data, aka BCD. This little guy can wreck your system and leave Windows unable to boot, so proceed with caution.

Using bcdedit to limit available RAM

I work on developer tools for a living, and one of the things I do is look at the systems developers are currently using, so that we can make sure we're evaluating the performance of our tools on the same hardware our customers use. This includes desktops with 16GB RAM. Lucky me, my workstation at work has 32GB, and my home build was recently upgraded to 64GB.

So how, you might wonder, does one tell Windows to use less RAM, so that tests can be run without the need for me to remove sticks of RAM from my computer?

Turns out it's actually super easy. Fire up an admin Powershell session, and run bcdedit /enum /v to return a list of bcd entries. You'll see something like this:

Windows Boot Manager
identifier              {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device                  partition=\Device\HarddiskVolume7
path                    \EFI\MICROSOFT\BOOT\BOOTMGFW.EFI
description             Windows Boot Manager
locale                  en-US
inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
badmemoryaccess         Yes
flightsigning           Yes
default                 {43ff7fb9-18f1-11ea-9238-86832cd65786}
resumeobject            {43ff7fb8-18f1-11ea-9238-86832cd65786}
displayorder            {43ff7fb9-18f1-11ea-9238-86832cd65786}
toolsdisplayorder       {b2721d73-1db4-4c62-bf78-c548a880142d}
timeout                 30

Windows Boot Loader
identifier              {43ff7fb9-18f1-11ea-9238-86832cd65786}
device                  partition=C:
path                    \WINDOWS\system32\winload.efi
description             Windows 10
locale                  en-US
inherit                 {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
recoverysequence        {43ff7fbb-18f1-11ea-9238-86832cd65786}
displaymessageoverride  Recovery
recoveryenabled         Yes
badmemoryaccess         Yes
isolatedcontext         Yes
flightsigning           Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \WINDOWS
resumeobject            {43ff7fb8-18f1-11ea-9238-86832cd65786}
nx                      OptIn
bootmenupolicy          Standard
hypervisorlaunchtype    Auto

You'll see down there on row 19 a property called identifier - this is the GUID of your Windows installation. Armed with this information, you can edit the boot config to limit the amount of memory available to Windows. This is documented here, but there was one crucial piece of information missing from that page - how to calculate the amount of RAM to remove.

The easiest way is to use this useful calculator, but you can also use math if you're into that sort of thing. If you want to remove RAM by gigabytes, multiply the gigs to remove by 2^10. So, if you want to remove a gig, you're going to remove 1024 megabytes.

In my case, I need to remove 16GB, or 16384MB.

bcdedit /set '{43ff7fb9-18f1-11ea-9238-86832cd65786}' removememory 16384

Reboot, and check your system properties - your system memory should say something like 32.0 GB (15.93 usable). To revert the change and restore your system to its installed RAM, just run:

bcdedit /deletevalue '{43ff7fb9-18f1-11ea-9238-86832cd65786}' removememory
abg/bcdedit_tips.txt · Last modified: 2020/03/08 17:34 by clairelyclaire
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0