Set Surface Asset Tag During a Configuration Manager Task Sequence


Update 12/1/2015: Script updated to version 1.1 to add support for Surface Pro 4, Surface 3, and SurfaceBook

The August 2014 firmware update for the Surface Pro 3 now allows you to set an asset tag field in the UEFI firmware. Many companies like to have this field set and sometimes use the asset tag to name computers during imaging.

The September 2015 firmware update adds support for the AssetTag field in the Surface 3.

You set the asset tag in UEFI by running an executable (AssetTag.exe - Surface Pro 3 Asset Tag CLI Utility) with the –s parameter followed by the characters you want to set the asset tag to. The asset tag can be up to 36 characters long. Valid characters include A-Z, a-z, 0-9, period and hyphen.

You can run the AssetTag.exe tool in WinPE or in the Full OS. I’ve created a script that will help ensure the asset tag is set during a task sequence if it’s not already. You will probably want to set this after the “Partition Disk 0 – UEFI” step to ensure you get prompted for the asset tag early in the task sequence.

This is using a "Run Command Line" step referencing a package contains the script files available for download below.

You will also want to ensure the step for the script only runs if the model is contains Surface

Here's the syntax for the WMI Query: select * from win32_computersystem where model like "%Surface%"

What The Script Does:

  1. Gets the SMBIOSAssetTag property from the win32_systemenclosure class. The SMBIOSAssetTag property is where the asset tag from the firmware is stored in WMI.
  2. If the SMBIOSAssetTag is equal to 0, that means the asset tag has not been set in the UEFI firmware. If the SMBIOSAssetTag is anything other than 0, the script won’t do anything unless you enable step 5 that sets the hostname to the asset tag.
  3. If the asset tag is 0, the script will hide the current task sequence process dialog and prompt the user to enter an asset tag.
  4. Error handling:
    1. Outdated Firmware: I added some logic to detect if the current firmware version does not support setting the asset tag. If the firmware needs to be updated, the AssetTag.exe tool will fail with error code 775. If this happens, the script will show a message box that says “You need to apply the latest UEFI firmware update to support setting the asset tag”. The script will then exit with error code 775 and the task sequence will fail if continue on error is not checked. You can create a USB drive to update the firmware based in this post or update the firmware using Windows Update.
    2. Other Errors: Any other error code returned from the AssetTool.exe will show a message box “Failed to set the asset tag: valid characters include A-Z, a-z, 0-9, period and hyphen. Error code: (X)”. The script will fail with exit code the AssetTool.exe returned and the task sequence will fail if continue on error is not checked.
  5. Optional Set Computer Name:  You can remove the comment from line 44 to have the script set the OSDComputerName task sequence variable to whatever the user entered into the dialog prompt. Note: This current version has no logic to ensure the input is less than 15 characters and contains valid characters for a hostname.

Files Included in The Download:

The script is a VBScript and pretty straight forward. The following files are included in the zip below:

  • SurfaceAssetTag.vbs (This is the actual script. Run wscript.exe SurfacePro3AssetTag.vbs in a run command step the package that has all these files)
  • AssetTag.exe (The tool the actually sets the asset tag in the firmware. The AssetTag.exe included in the zip below was dated 9/25/14 you may want to check for a newer version here before running the script)
  • Surface Pro 3 Asset Tag README.txt (A readme file from the download)

Click Here To Download The Script

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of any included script samples are subject to the terms specified in the Terms of Use

Comments (17)
  1. Kmac says:

    Hi, Great article,

    can you advise where I would "Set 5" to set the hostname to become the asset tag?

    It would be great if this could be set to use the machine name during the build?

    Many Thanks

  2. Not sure I’m following the question "set 5" ?

  3. crashrebootrepeat says:

    Hi please clarify because I can’t tell from your screen shots: I am assuming I am supposed to connect to a network drive? Otherwise how does OSD find the location of the VBS ?

  4. Richard says:

    Is there any way to make the script set the computer name if there is already an Asset Tag? For example, if I reimage a Surface that already has an Asset Tag the computer name stays as MINIT-XXXXXXX. I’d like to use this script to set the name if there
    is already an Asset Tag in place and to prompt for one if there isn’t.

  5. @Richard, that should be the way it works know. If there is already a value in the AssetTag field in WMI it skips the prompt. You will just have to uncomment out the line for naming the computer as mentioned.

  6. Richard says:

    When no Asset Tag is present I receive the prompt and the Surface is named correctly. When there is already an Asset Tag in place the Surface gets a MININT name. I have removed the comment from line 44.

  7. Ewan says:

    I can also replicate the behaviour mentioned by Richard…

  8. Did you guys update the DP’s after modifying the line to uncomment out the naming. From what I see it should work fine.

  9. Richard says:

    Yes, I’ve also created an entirely new package that has the line commented out. I did this just to be sure that the DP got the correct script.

  10. Gavin says:

    Will this work on the Surface Pro 4?

  11. Yes, as mentioned in the post

  12. Gavin says:

    Justin, thank you for the reply.

  13. adam says:

    Doesn’t Work… Will not set the Asset Tag as the computer name

  14. Adam Lorde says:

    the rest of your script is probably OK – I will do some more testing. I am going to comment out line 44 and add a Powershell script at the end of the TS to rename the Computer to the Asset Tag. I will keep you posted on how that goes. Ideally, an all in
    one script like yours would be the best.

  15. Tom says:

    Can you please help with even if it is existing and it has a 0 it still pops up to enter an asset tag?

    Please provide that asap and to be honest this is great stuff.

  16. Jawwad Sayed says:


    Thanks for the script.

    I am trying this script and getting the prompt also as expected via Config Manager OSD TS. But as we have a password set in the UEFI we get Access Denied. Is there a way where we can pass the password in the script.

    Device is Surface Book & Surface Pro 4

Comments are closed.

Skip to main content