Jump to content


commissar117

create a variable in SCCM TS for logged in user

Recommended Posts



There are several ways to do that, how do you intend to input the logged in user name and are you doing this in WinPE or after the OS is installed? Outline of a couple script ways below. You can also create the variable within the TaskSequence through the Add - General - Set Task Sequence Variable; but I don't think that was your intent....

 

----

.vbs file

 

'Setup the environment

Set oTSEnv = CreateObject("Microsoft.SMS.TSEnvironment")

strName = strInputName

'Write the TSVariable
oTSEnv("genericTSvariablename") = strUserName
Then call %genericTSvariablename% as you do in your example
-----
.ps1
#Call SMS environment
$Tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$strName = $Tsenv.value("genericTSvariablename")

 

Then call %genericTSvariablename% as you do in your example

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...