Set the computer name using the BIOS Asset Tag

If you are setting the Asset Tag the same name that the computer is, it makes sense to only have to input it once. I created a powershell script that will do the following:

If VM or Mac: Exit 0

If  computer exists in SCCM: Exit 0

If AssetTag Exists/Not empty: Set OSDComputerName to AssetTag, Exit 0

If AssetTag doesn't exist: Bring up an error message, Exit 1

 

Tested with HP and Dell machines.

Download Script https://github.com/happysccm/Files/tree/master/Check%20for%20Asset%20Tag%20-%20OSD%20AssetTag%20Check%20-%20Most%20code%20by%20Nickolaj%20and%20Dave%20Green

Update: Added optional script that uses the HP Ownership Tag

How to use:
Create a package for the script

Copy serviceUI.exe (From MDT Toolkit) to the same folder.

In the Task Sequence after initial format of the drive create a Run Command Line step using the package that you created

with the command: ServiceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File AssetTag.ps1

 

Thanks Nickolaj and Dave Green for the initial form

 

4 Comments

  1. Michael Spann June 6, 2017 Reply

    Okay, I have a problem..

    We have over 600 hp laptop/6oo Dell laptops in-house and remote. I created an inventory report and discover hardware with no asset number or wrong asset number. I want script that will allow me to update the asset number, I can't go to each machine and perform this update so I would to see if I can find a script of find some way to use SCCM 2012 to do the update.

    Thank You
    Michael Spann

    • Author
      Jay Connor July 4, 2017 Reply

      Hi Michael,

      Anything is possible - If you want it automated first you would need something such as an excel sheet with the correct information. Then use some of Dell's BIOS management tools in a powershell script to correct it.

  2. Hey Jay,

    Good work on this!

    I used your script as a template and changed it abit:

    If $bios is null, then it prompts for a hostname which gets set as OSDComputerName.

    This works great, next step I'm adding is using the HP Bios utility to write this to the system. Skips the step of someone manually going to the BIOS to get it done.

    Cheers,
    Lu

    • Author
      Jay Connor July 25, 2017 Reply

      Nice! Blog it!! 🙂

      We have had some strange issues on HP's where the script works manually and not in the TS so temporarily disabled ours on HP.
      Hope all goes well in your environment

Leave a Reply to Michael Spann Cancel reply

Your email address will not be published. Required fields are marked *

*