Setting an Asset Tag on ThinkPads with a MDM




For anyone that would like to set an Asset Tag on their ThinkPad once the device is under management with either Intune or MobileIron, this post can provide a way of helping you achieve this.

For those that are unaware, there is a Windows Utility to Read and Write Asset ID Information provided by Lenovo, specifically for ThinkPad.  With this utility, you are able to set asset ID data such as an Owner Name, Owner Location, Asset Number and several other pieces of information.  Per the ReadMe, here's a list of what can be set with the tool:


--------------------
USERDEVICE          <Field1>  -  These fields are defined by the user.
                       :         The maximum number of user fields is five.
                    <Fieldn>

PRELOADPROFILE          IMAGEDATE
                        IMAGE
 

USERASSETDATA         PURCHASE_DATE
                      LAST_INVENTORIED
                      WARRANTY_END
                      WARRANTY_DURATION
                      AMOUNT
                      ASSET_NUMBER

LEASEDATA          LEASE_START_DATE
                   LEASE_END_DATE
                   LEASE_TERM
                   LEASE_AMOUNT
                   LESSOR

OWNERDATA          OWNERNAME
                   DEPARTMENT
                   LOCATION

                   PHONE_NUMBER
                   OWNERPOSITION

NETWORKCONNECTION          NUMNICS
                           GATEWAY
                           IPADDRESS[n]   (1<=n<=NUMNICS, default is 1)
                           SUBNETMASK[n]
                           SYSTEMNAME
                           LOGINNAME

Note: The USERASSETDATA.ASSET_NUMBER is available through WMI by querying the SMBIOSAssetTag field of the Win32_SystemEnclosure class.


--------------------

What's highlighted above is what's in the sample PowerShell script below, which can be deployed using the Intune Management Extension or MobileIron Cloud with Bridge.

$url = "https://download.lenovo.com/pccbbs/mobiles/giaw03ww.exe" # URL to WinAIA Utility
$path = "$($env:ProgramData)\Lenovo\WinAIA"
$pkg = "giaw03ww.exe"

# Create temp directory for utility and log output file
if (!(Test-Path -Path $path)) {
    Write-Host "--------------------------------------------------------------------------------------"
    Write-Host "Creating Lenovo Directory"
    Write-Host "--------------------------------------------------------------------------------------"
    New-Item -Path $path -ItemType Directory -ErrorAction SilentlyContinue
}

# Download utility via HTTPS

Write-Host "--------------------------------------------------------------------------------------"
Write-Host "Downloading WinAIA Utility"
Write-Host "--------------------------------------------------------------------------------------"

Start-BitsTransfer -Source $url -Destination "$path\$pkg"

# Set location of WinAIA Package and extract contents
Set-Location -Path $path
$extractSwitch = "/VERYSILENT /DIR=.\ /EXTRACT=YES"

Start-Process "$path\$pkg" -ArgumentList $extractSwitch -Wait

# Variable for last 5 numbers of Unique ID
$uuid = (Get-CimInstance -Namespace root/CIMV2 -ClassName Win32_ComputerSystemProduct).UUID.SubString(30)

# Set Owner Data with WinAIA Utility.  These are sample values and can be changed.
Write-Host "--------------------------------------------------------------------------------------"
Write-Host "Writing Asset Owner Information"
Write-Host "--------------------------------------------------------------------------------------"

.\WinAIA64.exe -silent -set "OWNERDATA.OWNERNAME=Lenovo"
.\WinAIA64.exe -silent -set "OWNERDATA.DEPARTMENT=Commercial Deployment Readiness Team"
.\WinAIA64.exe -silent -set "OWNERDATA.LOCATION=Morrisville,NC"

# Set Asset Number.  Available through WMI by querying the SMBIOSASSetTag field of the Win32_SystemEnclosure class
# Example shows the $uuid is prefixed with CDRT.  This can be replaced as you see fit.
Write-Host "--------------------------------------------------------------------------------------"
Write-Host "Setting Asset Tag"
Write-Host "--------------------------------------------------------------------------------------"

.\WinAIA64.exe -silent -set "USERASSETDATA.ASSET_NUMBER=CDRT-$uuid"

# AIA Output file
Write-Host "--------------------------------------------------------------------------------------"
Write-Host "Outputting AIA Text File"
Write-Host "--------------------------------------------------------------------------------------"

.\WinAIA64.exe -silent -output-file "$path\aia_output.txt" -get OWNERDATA

# Remove Package
Write-Host "--------------------------------------------------------------------------------------"
Write-Host "Removing Package"
Write-Host "--------------------------------------------------------------------------------------"

Remove-Item -LiteralPath $path\$pkg -Force


 MobileIron Deployment

Save the sample script and go to your MobileIron Cloud console.  Click on the Configurations tab and select to Add a new configuration

 

Type in Bridge in the configuration search field and select MobileIron Bridge

 
Define a name and either drag/drop the .ps1 file to the console or manually choose to search and upload it

 

Continue through the distribution and assignments wizard to complete the MI Bridge Configuration

Intune Deployment

Save the sample script and go to your Intune management portal.  Click on the Device Configurations blade and select PowerShell Scripts



 Click Add


Enter a name and upload the file


Assign to users or devices group(s)

 


Once deployed to the target clients, you can double check by running the command WinAIA.exe -get



The following window will pop up to show what's been set.  The -output-file switch also dumps a txt file that shows this as well.



You can also query the smbiosassettag property of the win32_systemenclosure class to see the updated tag. (a reboot may be required).