Freigeben über


Set Surface Asset Tag During a Configuration Manager Task Sequence

Overview:

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.
    image
  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.
      image
    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.
      image
  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.
    image

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

  • Anonymous
    July 06, 2015
    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
  • Anonymous
    July 06, 2015
    Not sure I'm following the question "set 5" ?
  • Anonymous
    October 26, 2015
    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 ?
  • Anonymous
    December 04, 2015
    The comment has been removed
  • Anonymous
    December 04, 2015
    The comment has been removed
  • Anonymous
    December 07, 2015
    The comment has been removed
  • Anonymous
    January 12, 2016
    The comment has been removed
  • Anonymous
    January 13, 2016
    The comment has been removed
  • Anonymous
    January 28, 2016
    The comment has been removed
  • Anonymous
    February 04, 2016
    Will this work on the Surface Pro 4?
  • Anonymous
    February 04, 2016
    Yes, as mentioned in the post
  • Anonymous
    February 05, 2016
    Justin, thank you for the reply.
  • Anonymous
    February 10, 2016
    Doesn't Work... Will not set the Asset Tag as the computer name
  • Anonymous
    February 10, 2016
    I will do some test
  • Anonymous
    February 11, 2016
    The comment has been removed
  • Anonymous
    August 10, 2016
    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.
  • Anonymous
    May 25, 2017
    Hi, 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