How to Get the Motherboard Model and Manufacturer in Batch Script
Identifying the motherboard (or "baseboard") is a crucial step when performing hardware inventories, checking for driver updates, or verifying system compatibility for a hardware upgrade. This information is not available through simple file commands, as it is stored in the computer's firmware (BIOS/UEFI).
This guide will teach you how to use the built-in WMIC (Windows Management Instrumentation Command-line) utility to query the system for the manufacturer and model of its motherboard. You will learn the simple command to display this information and the standard scripting pattern to capture these values into variables for use in your automation scripts.
The Core Command: WMIC BASEBOARD GET
The standard way to get detailed hardware information from the command line is with WMIC. The specific WMI "alias" for the motherboard is BASEBOARD, which corresponds to the Win32_BaseBoard WMI class.
The command to get the manufacturer and model is:
WMIC BASEBOARD GET Manufacturer, Product
WMIC: The command-line utility.BASEBOARD: The alias for the motherboard.GET Manufacturer, Product: The specific properties we want to retrieve.
Key Motherboard Properties Explained
Manufacturer: The company that manufactured the motherboard (e.g.,ASUSTeK COMPUTER INC.,Micro-Star International Co., Ltd.,Dell Inc.).Product: The model name or number of the motherboard (e.g.,ROG STRIX Z390-E GAMING,B450 TOMAHAWK MAX).SerialNumber: The unique serial number of the motherboard (though this is often left blank by manufacturers).
Basic Example: Displaying Motherboard Information
You can run this command directly in a command prompt to see the motherboard details for your current machine.
@ECHO OFF
ECHO --- Querying Motherboard Information ---
ECHO.
WMIC BASEBOARD GET Manufacturer, Product
The output from WMIC is formatted in columns with a header.
--- Querying Motherboard Information ---
Manufacturer Product
ASUSTeK COMPUTER INC. ROG STRIX Z390-E GAMING
How to Capture the Information in Variables
To use this data in a script, you need to parse the WMIC output and store the manufacturer and product in separate variables. The FOR /F loop is the standard tool for this.
@ECHO OFF
SET "MoboManufacturer="
SET "MoboProduct="
ECHO --- Capturing Motherboard Information ---
REM 'skip=1' ignores the header line. 'tokens=1,2*' can help with spaces.
FOR /F "skip=1 tokens=1,*" %%A IN ('WMIC BASEBOARD GET Manufacturer, Product') DO (
SET "MoboManufacturer=%%A"
SET "MoboProduct=%%B"
GOTO :InfoCaptured
)
:InfoCaptured
IF NOT DEFINED MoboManufacturer (
ECHO [FAILURE] Could not retrieve motherboard information.
GOTO :EOF
)
ECHO.
ECHO Manufacturer: %MoboManufacturer%
ECHO Model: %MoboProduct%
skip=1: Ignores theManufacturer Productheader line.tokens=1,*: This is a robust way to parse the output. It assigns the first "word" (ASUSTeK) to%%Aand everything else on the line to%%B, correctly capturing model names that contain spaces.GOTO :InfoCaptured: Exits the loop immediately after capturing the first line of data.
How the WMIC BASEBOARD Method Works
The WMIC BASEBOARD command is an interface to the WMI service, which manages system data. It queries the Win32_BaseBoard class, which reads information directly from the System Management BIOS (SMBIOS) data stored in the computer's firmware. This information is populated by the motherboard manufacturer at the factory, making it an authoritative source for hardware identification.
Common Pitfalls and How to Solve Them
Problem: The Values are Generic or Missing
This is the most common issue you will face. On many custom-built or "white-box" PCs, the manufacturer may not have correctly filled in the SMBIOS fields.
Example of Generic Output:
Manufacturer Product
System manufacturer System Product Name
Or you might see values like To be filled by O.E.M. or Default string.
This is not a script failure. It is a result of the hardware manufacturer not providing the data. Major brands like Dell, HP, Lenovo, etc., are usually very reliable.
Solution: Your script should be written to handle this possibility, perhaps by checking for these generic strings and reporting the information as "Unavailable."
Problem: Parsing the WMIC Output
The standard table format of WMIC can be tricky if not handled correctly.
Solution: The FOR /F "skip=1 tokens=1,*" loop is the most reliable pattern for this specific query. It correctly separates the (usually single-word) manufacturer from the (often multi-word) product name.
Practical Example: A Key Hardware Inventory Script
This script gathers the essential "trifecta" of system identification (Motherboard, CPU, and BIOS Serial Number) and prints a clean report.
@ECHO OFF
SETLOCAL
ECHO --- System Hardware Inventory ---
ECHO Computer Name: %COMPUTERNAME%
ECHO -------------------------------
ECHO.
REM --- Get Motherboard Info ---
FOR /F "skip=1 tokens=1,*" %%A IN ('WMIC BASEBOARD GET Manufacturer, Product') DO (
SET "MoboMan=%%A" & SET "MoboMod=%%B" & GOTO :GotMobo
)
:GotMobo
ECHO Motherboard: %MoboMan% - %MoboMod%
REM --- Get CPU Info ---
FOR /F "skip=1 delims=" %%C IN ('WMIC CPU GET Name') DO (
SET "CPUName=%%C" & GOTO :GotCPU
)
:GotCPU
ECHO Processor: %CPUName%
REM --- Get BIOS Serial ---
FOR /F "skip=1" %%S IN ('WMIC BIOS GET SerialNumber') DO (
SET "SerialNum=%%S" & GOTO :GotSerial
)
:GotSerial
ECHO Serial #: %SerialNum%
ENDLOCAL
Conclusion
The WMIC BASEBOARD command is the standard, built-in, and most reliable method for identifying a computer's motherboard from a batch script.
Key takeaways:
- Use
WMIC BASEBOARD GET Manufacturer, Productto query the motherboard details. - Use a
FOR /F "skip=1 tokens=1,*"loop with aGOTOto reliably capture the manufacturer and model into separate variables. - Be aware that some hardware manufacturers may not provide unique or descriptive information, which is a hardware limitation, not a script error.
- This command can be extended to query remote machines (
/NODE:"hostname") for powerful network-wide inventory.