Inspect and Modify UEFI Variables in UEFI Shell

This guide explains how to view, export, edit, and delete non-volatile UEFI runtime variables using native commands within the UEFI Shell environment. By using the built-in dmpstore and setvar commands, system administrators and developers can inspect NVRAM configurations, modify boot behavior, or clear corrupted variable entries directly at the firmware level without booting into an operating system.


Inspecting Variables with dmpstore

The dmpstore (Dump Variable Store) command displays the contents of the UEFI variable store. It provides variable names, vendor GUIDs, attributes, and data payloads.

1. List All Variables

To display all variables currently stored in the system's NVRAM:

dmpstore

2. Page Through Variable Output

Because the variable store contains dozens of entries, pipe the command to pause per page:

dmpstore -b

3. Search for a Specific Variable

To inspect a single variable across all namespaces, provide its name:

dmpstore BootOrder
dmpstore Boot0001

4. Filter by Variable GUID

To inspect variables belonging to a specific vendor or specification GUID:

dmpstore -guid 8BE4DF61-93CA-11D2-AA0D-00E098032B8C

5. Export Variables to a File

To export the entire variable store or specific variables to a binary file on a mounted filesystem (e.g., FS0:):

dmpstore -s FS0:\vars_backup.bin

To export only a specific variable:

dmpstore BootOrder -s FS0:\BootOrder.bin

Modifying Variables with setvar

The setvar command creates, modifies, and deletes UEFI variables. To make a variable persistent across system reboots, it must include the non-volatile (NV) attribute.

Variable Attributes

When creating or modifying variables, the following attribute flags are typically used:

  • NV: Non-Volatile (stores the variable in NVRAM across power cycles)
  • BS: Boot Service Access (accessible during pre-boot)
  • RT: Runtime Access (accessible by the operating system after ExitBootServices)

1. Creating or Modifying a Variable

To define a non-volatile variable accessible to both firmware and the OS, specify the name, GUID, attributes, and data payload.

Setting raw hexadecimal data:

setvar MyTestVar -guid 12345678-ABCD-EF01-2345-6789ABCDEF01 -attr NV,BS,RT =0x01 0x02 0x03 0x04

Setting ASCII string data:

setvar CustomConfig -guid 12345678-ABCD-EF01-2345-6789ABCDEF01 -attr NV,BS,RT ="Enabled"

2. Modifying Variables from a Binary File

If you have a binary payload saved on a drive, you can assign its contents directly to a variable:

setvar BootOrder -guid 8BE4DF61-93CA-11D2-AA0D-00E098032B8C -f FS0:\NewBootOrder.bin

3. Deleting a Non-Volatile Variable

In UEFI, a variable is deleted by setting its data length to zero while matching its exact name and GUID:

setvar MyTestVar -guid 12345678-ABCD-EF01-2345-6789ABCDEF01 =

Leaving the section after the equals sign (=) empty clears the entry from NVRAM.