question

ZacAlam-7058 avatar image
0 Votes"
ZacAlam-7058 asked saldana-msft edited

Set an Asset Tag number manually during SCCM TS, Lenovo ThinkPad’s

Hi Folks,
I am trying to Set an Asset Tag number manually during SCCM TS for our Lenovo ThinkPad machines. Able to add a pane to MDT and ask for the Asset Tag and store it in a variable name 'TSAssetTag'. This portion works fine during OSD, I am not able to pass the value from the text field e.g. '1234' into the TS. I am not seeing the value from the text field anywhere in smsts.log. The end goal is to set the asset tag value and write to BIOS, I have a command line that I can run. I been looking online and closest articles I see is https://social.technet.microsoft.com/Forums/en-US/b874abfd-3877-4348-8571-6679fc6ede61/using-mdt-custom-input-field-to-set-asset-tag?forum=mdt . We must use a manual entered value from the text field to write to the BIOS only, need to pass the variable that I get from the custom pane. The Code I am using in 2 steps of TS in PS is below. Not sure what i am doing wrong here? Any guidance here would be great, thanks!
1.get Variable TSAssetTag
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$tsenv.Value('TSAssetTag') = $TSAssetTag
$LogPath = $tsenv.Value("_SMSTSLogPath")

2.\WinAIA64.exe -silent -set "USERASSETDATA.ASSET_NUMBER=$TSAssetTag"
198578-image.png


198500-image.png


mem-cm-generalmem-cm-osdmem-mdtmem-autopilot
image.png (193.0 KiB)
image.png (129.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimonRenMSFT-3639 avatar image
0 Votes"
SimonRenMSFT-3639 answered

Hi,

Thanks for posting in Microsoft MECM Q&A forum.

You can try to use ServiceUI to launch a batch file to set the asset tag like below.
%ToolRoot%\ServiceUI.exe %windir%\system32\cmd.exe /c %SCRIPTROOT%\Lenovo_settag.bat

For more detalied information, please refer to this similar thread: Interactive script in MDT

Hope it helps. Thanks for your time.

Best regards,
Simon


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ZacAlam-7058 avatar image
0 Votes"
ZacAlam-7058 answered SimonRenMSFT-3639 commented

Thanks for your reply that did not work for me & errored out, The WINAIA64.exe Lenovo utility is in the Scripts directory of Deployment Share. I do not need to use ServiceUI as I have the custom pane for entering asset tag right and would prefer to leverage that instead. I need to pass the asset tag number when entered to the variable TSAssetTag. Then TSAssetTag to write to BIOS using .\WinAIA64.exe -silent -set "USERASSETDATA.ASSET_NUMBER=$TSAssetTag"
Not sure what i am doing wrong still not getting the variable entered to set in asset tag....

198640-image.png


198784-image.png



image.png (17.4 KiB)
image.png (38.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

Thanks for your reply.

It's really strange. I will do more research, if there is any update, I will let you know. Thanks for your understanding.

Best regards,
Simon

0 Votes 0 ·
ZacAlam-7058 avatar image
0 Votes"
ZacAlam-7058 answered

This is resolved.
Net new machines created a MDT UDI Wizard TS as mentioned followed by Run Command Line .\WinAIA64.exe -silent -set "USERASSETDATA.ASSET_NUMBER=%TSAssetTag%" (looking at package during Run Command Line 'WinAIA64')
Existing machines a bit more tricker , great help from https://smsagent.blog/2014/01/30/prompting-for-input-during-a-task-sequence/ , tweaked as below and added into a new TS.
Run Command Line - ServiceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File PROMPTFORASSETTAGv6.ps1
<#
PromptForAssetTag v6


This script prompts for input during a task sequence, and sets the input as a TS variable.

>

Close the TS UI temporarily

$TSProgressUI = New-Object -COMObject Microsoft.SMS.TSProgressUI
$TSProgressUI.CloseProgressDialog()


Prompt for input

[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null

$TSAssetTag = [Microsoft.VisualBasic.Interaction]::InputBox("Enter Asset tag on the reverse of the machine", "AssetTag prompt", "eg 1234")


Set the TS variable

$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$tsenv.Value("TSAssetTag") = $TSAssetTag


New-Item -ItemType Directory -force -path c:\logs\AssetTag
New-Item -ItemType Directory -force -path c:\Installers\AssetTag
$date = (get-date)

copy-item \***-sccm01\Sources\Applications\Lenovo\WinAIA64\WinAIA64.exe c:\Installers\AssetTag\WinAIA64.exe
c:\Installers\AssetTag\WinAIA64.exe -silent -set "USERASSETDATA.ASSET_NUMBER=$TSAssetTag"
write-output $date | out-file -encoding ascii -append -filepath 'c:\logs\AssetTag\assettag.txt'
write-output 'assettag written to BIOS' | out-file -encoding ascii -append -filepath 'c:\logs\AssetTag\assettag.txt'







5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MengdaHuang-8250 avatar image
0 Votes"
MengdaHuang-8250 answered

Hi, Sir

Thanks for your share.

Could you share all of the task about how to get TSAssetTag from UDI which user insert? when i follow the step of your shared. i got the value of Lenovo BIOS Asset Tag was "%TSAssetTag%" not the really value which user insert from UDI windows.

Thanks a lot.

Best Regards,

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.