Home Windows Batch file programming Batch File: How to retrieve Asset Tag / Serial Number for a...

Batch File: How to retrieve Asset Tag / Serial Number for a Dell computer


This guide is a quickie on how you can use a batch file to retrieve asset tag and / or serial number information for a Dell desktop or laptop.  This recipe assumes that the Dell computer has had its asset tag entered into the BIOS. Note, not all computer motherboards use this field in WMIC but Dell computers will.

Basic batch file skills will help you understand this process.

1. Create a new text file and rename it with a .bat extension (ie create a getasset.txt and rename to getasset.bat)

2. Right-click on the bat file we created (ie getasset.bat) and choose Edit.  This will open up notepad.

3. Enter in the following pieces of code:
@echo on

for /F "skip=2 tokens=2 delims=," %%A in ('wmic systemenclosure get serialnumber /FORMAT:csv') do (set "serial=%%A")

echo %serial%

4. Explanation of the batch file and for statement:

First, we are turning echo on to see what our batch will do. We using the WMIC command to access the asset tag information on the computer. Not all computers have an asset tag field or use it but Dell computers all do since most are used in an enterprise / corporate environment and are used to keep track of hardware.  We use CSV as our output format so we can parse the data w/our FOR and tokens statement.

We then are setting the asset tag information as a variable called: serial and then use the echo command to just display the information on screen.

I finish with the Pause command so that the batch file / command line window will not disappear after it runs.


  • -Create a batch file similar to above and have it output the data we set as the serial variable to a text file and then have another process copy all files back to a folder to combine and create an inventory list
  • -Use to create a sysprep batch file that would allow you to set the computer name during sysprep to the asset tag and then have it join the domain using the netdom.exe application (not natively in windows).
  • -This batch file can easily be modified to get any WMIC value; just open up a command prompt and type: WMIC <enter>  then type /? to get a full list of available parameters.



Please enter your comment!
Please enter your name here

error: Content is protected !!