How to Get Motherboard Manufacturer and Model in a Batch Script
Knowing the specific model of a computer's motherboard (also known as the baseboard) is a crucial piece of information for many administrative and diagnostic tasks. You might need it to determine driver compatibility, to check for BIOS updates, or simply for a hardware inventory audit.
This guide will teach you the standard and most reliable method for retrieving the motherboard manufacturer, model, and serial number using the built-in WMIC (Windows Management Instrumentation) command. You will learn the correct query to use and how to capture this information into variables for use in your scripts.
CRITICAL NOTE: Querying low-level hardware information is a privileged operation. For the most complete and accurate results, your script must be run with full administrator privileges.
The Core Command: WMIC BASEBOARD
The WMIC (Windows Management Instrumentation Command-line) utility is the definitive tool for querying system hardware information from a script. The BASEBOARD alias provides direct access to the data stored in the firmware (SMBIOS) about the computer's main circuit board.
Command: WMIC BASEBOARD GET Manufacturer,Product,SerialNumber
BASEBOARD: The WMI class for the motherboard.GET ...: Specifies the properties you want to display.
Basic Example: A Simple List of Motherboard Details
Running the basic WMIC command gives you a formatted table with the requested information.
@ECHO OFF
ECHO --- Querying Motherboard Information ---
ECHO This may take a moment...
ECHO.
WMIC BASEBOARD GET Manufacturer,Product,SerialNumber
PAUSE
The command produces a clean table with the details.
Manufacturer Product SerialNumber
Dell Inc. 0H81M5 /123ABC4DE/CN123456789012/
Or, on a custom-built PC:
Manufacturer Product SerialNumber
Micro-Star International Co., Ltd. MAG B550 TOMAHAWK (MS-7C91) Default string
Parsing the Output with FOR /F for Scripting
To use this information in a script, you need to capture it into variables. The FOR /F loop is the standard tool for this, especially when combined with the /VALUE format switch.
@ECHO OFF
SETLOCAL
SET "MoboMfg="
SET "MoboProduct="
ECHO --- Capturing Motherboard Details ---
ECHO.
FOR /F "tokens=1,* delims==" %%A IN (
'WMIC BASEBOARD GET Manufacturer^,Product /VALUE'
) DO (
IF "%%A"=="Manufacturer" SET "MoboMfg=%%B"
IF "%%A"=="Product" SET "MoboProduct=%%B"
)
REM Clean the variables of any invisible trailing characters (a WMIC bug).
FOR %%N IN ("%MoboMfg%") DO SET "MoboMfg=%%~N"
FOR %%N IN ("%MoboProduct%") DO SET "MoboProduct=%%~N"
ECHO Manufacturer: %MoboMfg%
ECHO Product/Model: %MoboProduct%
ENDLOCAL
Key WMIC BASEBOARD Properties Explained
You can GET several useful properties from the BASEBOARD class:
| Property | Description |
|---|---|
Manufacturer | The name of the company that made the motherboard (e.g., "Dell Inc.", "ASUSTeK COMPUTER INC."). |
Product | The model name or number of the motherboard (e.g., "0H81M5", "ROG STRIX Z690-E"). |
SerialNumber | The unique serial number of the motherboard. |
Version | The version or revision of the motherboard (e.g., "1.0"). |
Common Pitfalls and How to Solve Them
-
Administrator Rights: For the most reliable and complete hardware information, you must run the script as an Administrator.
-
Generic Information: On some OEM machines (like Dell or HP), the
Productmight be a model number that isn't the public-facing name. On some custom-built PCs, theSerialNumbermight be a generic string like "Default string" or "To be filled by O.E.M.". This is a limitation of the information programmed into the firmware by the manufacturer, not a failure of the command. -
WMICOutput Quirks:WMICoften adds an invisible trailing carriage return to its values, which can interfere with string operations.- Solution: As shown in the script above, always "clean" a variable captured from
WMICby re-assigning it in a simpleFORloop (FOR %%N IN ("%Var%") DO SET "Var=%%~N").
- Solution: As shown in the script above, always "clean" a variable captured from
Practical Example: A System Hardware Information Report
This script gathers key hardware identifiers, including the motherboard model and serial number, and saves them to a report file. This is a common task for system inventory and auditing.
@ECHO OFF
SETLOCAL
SET "ReportFile=%USERPROFILE%\Desktop\Hardware_Info.txt"
ECHO --- Generating Hardware Inventory Report ---
ECHO Saving report to: "%ReportFile%"
ECHO.
REM --- Use a code block to redirect all WMIC output to the report file ---
(
ECHO System Hardware Report for: %COMPUTERNAME%
ECHO Generated on: %DATE% %TIME%
ECHO ==================================================
ECHO.
ECHO --- SYSTEM ENCLOSURE (Chassis) ---
WMIC COMPUTERSYSTEM GET Model,Manufacturer /VALUE
ECHO.
ECHO --- BASEBOARD (Motherboard) ---
WMIC BASEBOARD GET Manufacturer,Product,SerialNumber,Version /VALUE
ECHO.
ECHO --- BIOS ---
WMIC BIOS GET Manufacturer,SerialNumber,Version /VALUE
) > "%ReportFile%"
ECHO [SUCCESS] Report created.
ENDLOCAL
Conclusion
The WMIC BASEBOARD command is the standard and most effective built-in tool for getting detailed motherboard information from a batch script.
- The core command is
WMIC BASEBOARD GET Manufacturer,Product,SerialNumber. - For scripting, it is best to use the
/VALUEformat switch and parse the output with aFOR /Floop. - Always run your script as an Administrator for accurate results.
- Be prepared to "clean" the variables captured from
WMICto remove trailing characters.
By using this WMIC query, you can easily automate the process of hardware inventory and diagnostics for your Windows systems.