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
$pkg = "giaw03ww.exe"
$path = Join-Path $env:SystemDrive "Lenovo"
$tempDir = Join-Path $path "\Temp"

If ($ENV:PROCESSOR_ARCHITEW6432 -eq AMD64) {
     Try {
         &$ENV:WINDIR\SysNative\WindowsPowershell\v1.0\PowerShell.exe -File $PSCOMMANDPATH
     }
     Catch {
         Throw Failed to start $PSCOMMANDPATH
     }
     Exit
}

# Create temp directory for utility and log output file 

                Write-Host "--------------------------------------------------------------------------------------"
                Write-Host "Creating Temp Directory"
                Write-Host "--------------------------------------------------------------------------------------"

    if ((Test-Path -Path $tempDir) -eq $false) 
    {
        New-Item -Path $tempDir -ItemType Directory
    }
 
# Download utility via HTTPS

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

    Start-BitsTransfer -Source $URL -Destination $tempdir\$pkg

# Set location of WinAIA Package and extract contents

    Set-Location $tempDir
    $extractSwitch = "/VERYSILENT /DIR=.\ /EXTRACT=YES"
    Start-Process ".\$pkg" -ArgumentList $extractSwitch -Wait

# Variable for last 5 characters of Unique ID

$uuid = ((Get-WmiObject Win32_ComputerSystemProduct | Select-Object -ExpandProperty 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 "$tempdir\aia_output.txt" -get OWNERDATA

# Remove Package

                Write-Host "--------------------------------------------------------------------------------------"
                Write-Host "Removing Package"
                Write-Host "--------------------------------------------------------------------------------------"
    
    Remove-Item -LiteralPath $tempDir\$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).

Comments