Task Sequence Variables

mmtechsupport 1 Reputation point
2021-02-04T20:44:37.073+00:00

Hi All,

I have created a task sequence with custom variables. I would like to carry over those variables to the OS Setup portion which actually the variables are not available any more.
What is the best way to go about it?

Do i have to export the variables in a file and re-import them in the OS set up ?

So to give some background i am building with DHCP however in the last step after the config manager client set up i would like to set up static ip addresses. Those ip addresses have been inputed on winPE during the task sequence start.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,362 questions
Microsoft Configuration Manager Deployment
Microsoft Configuration Manager Deployment
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Deployment: The process of delivering, assembling, and maintaining a particular version of a software system at a site.
901 questions
Microsoft Configuration Manager
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Jason Sandys 31,151 Reputation points Microsoft Employee
    2021-02-04T22:02:14.07+00:00

    Assuming this is the same question from Reddit, has this not been resolved by using the Microsoft.SMS.TSEnvironment COM object from within your PowerShell script to access the task sequence variables and their values?

    0 comments No comments

  2. Amandayou-MSFT 11,046 Reputation points
    2021-02-05T09:14:59.373+00:00

    Hi @mmtechsupport ,

    Agree with Jason, we could export SCCM task sequence variables with PowerShell.

    Please refer to this article:
    https://blog.richprescott.com/2017/09/export-sccm-task-sequence-variables.html

    So to give some background i am building with DHCP however in the last step after the config manager client set up i would like to set up static ip addresses.

    Here are similar posts, kindly refer to them:
    https://social.technet.microsoft.com/Forums/ie/en-US/88aa703d-e69b-43e9-93bb-fbf6d80377d0/assign-static-ip-during-osd-task-sequence?forum=configmgrgeneral
    https://www.petervanderwoude.nl/post/setting-a-static-ip-address-during-a-deployment-via-powershell-and-configmgr-2012/

    Note: This is non-official Microsoft article just for your reference.


    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.


  3. mmtechsupport 1 Reputation point
    2021-02-05T14:45:12.897+00:00

    Still trying to dump the values - work in progress - Will update shortly

    0 comments No comments

  4. Jason Sandys 31,151 Reputation points Microsoft Employee
    2021-02-05T16:55:34.133+00:00

    Sorry, but no. I'm not at all saying to export or dump the variables.

    As noted, if this is the same as the Reddit thread, the problem is that you cannot directly access task sequence variables within a PowerShell script run during a task sequence as if they were PowerShell variables without using the Microsoft.SMS.TSEnvironment COM object.


  5. mmtechsupport 1 Reputation point
    2021-02-09T14:14:29.067+00:00

    So i have now resolved it

    Thank you all for help

    I had to do 2 things.

    First - make the variables available to PowerShell.
    Second - do that inside the PowerShell script - NOT in a discreet TS step.

    Works fine!