none
Using MDT custom input field to set Asset Tag RRS feed

  • Question

  • I was able to add a pane to MDT and ask for the Asset Tag and store it in a variable called AssetTag.  I used MDT Wizard Studio to create the new pane.

    I have a command line that I can run to set the Asset Tag in the BIOS.  I just don't know how to get the AssetTag variable to the command line.  I may also require to have the command line run during specific TS.

    Please help.

    Thanks,


    Friday, October 27, 2017 3:06 PM

Answers

  • Got it. You need to access SMSTS environment. It is really easy from within PowerShell:
    $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
    $logPath = $tsenv.Value("LogPath")
    Sorry about the formatting, TechNet and iOS are not a good match :)
    Take a look at one of my scripts for more examples: https://github.com/AdmiralTolwyn/Files/blob/master/MDT/

    Cheers,
    Anton

    Vacuum Breather Blog | Wing Commander Saga | Twitter

    Note: Posts are provided "AS IS" without warranty of any kind. If posts are helpful please don't forget to rate them as "Helpful" or as "Answer".

    • Marked as answer by pber Friday, October 27, 2017 5:47 PM
    Friday, October 27, 2017 4:19 PM

All replies

  • Just to make sure...Asset tag as in setting asset tag in BIOS?

    Cheers,
    Anton

    Vacuum Breather Blog | Wing Commander Saga | Twitter

    Note: Posts are provided "AS IS" without warranty of any kind. If posts are helpful please don't forget to rate them as "Helpful" or as "Answer".

    Friday, October 27, 2017 3:21 PM
  • Yes that is correct.    I have a command line that I can run from within a batch or script or even a MDT TS, but I need to pass the variable that I get from the custom pane to the script/batch/TS.

    Unfortunately my systems don't come with the asset tag information pre-populated from manufacturer/vendor.  So to set my BIOS, I have a command that I run that sets the asset tag.  I just need to know how to the the AssetTag variable that I create in my new MDT pane and pass that to my command line.

    i.e.

    ilorest set ServerAssetTag=%AssetTag%

    • Edited by pber Friday, October 27, 2017 4:10 PM
    Friday, October 27, 2017 3:42 PM
  • Got it. You need to access SMSTS environment. It is really easy from within PowerShell:
    $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
    $logPath = $tsenv.Value("LogPath")
    Sorry about the formatting, TechNet and iOS are not a good match :)
    Take a look at one of my scripts for more examples: https://github.com/AdmiralTolwyn/Files/blob/master/MDT/

    Cheers,
    Anton

    Vacuum Breather Blog | Wing Commander Saga | Twitter

    Note: Posts are provided "AS IS" without warranty of any kind. If posts are helpful please don't forget to rate them as "Helpful" or as "Answer".

    • Marked as answer by pber Friday, October 27, 2017 5:47 PM
    Friday, October 27, 2017 4:19 PM
  • Thanks.  That worked like a charm.

    Much appreciated.

    Friday, October 27, 2017 5:48 PM
  • Glad I could help.

    Cheers,
    Anton

    Vacuum Breather Blog | Wing Commander Saga | Twitter

    Note: Posts are provided "AS IS" without warranty of any kind. If posts are helpful please don't forget to rate them as "Helpful" or as "Answer".

    Friday, October 27, 2017 5:56 PM