Jump to content

Task Sequence variables in SCCM


RayRay
 Share

Recommended Posts

I'm trying to read a custom task sequence variable in a SCCM 2012 task sequence. Has anyone done this? I can do it in a vb script, just trying to port this to autoit so I can have more functionality.

VB looks like this:      set env = CreateObject("Microsoft.SMS.TSEnvironment")

                                  name = inputbox( prompt for name)

                                  env("OSDComputerName") = Name

Thanks for any help with this.

The vb code is just an example.

Edited by RayRay
Link to comment
Share on other sites

  • 1 month later...

I think we finally found the one thing VBScript can do that AutoIT can't.  I ended up having AutoIT write a VBScript and then launch it.  It was a sad day: 

 $CompName = $Prefix & $Serial & $Suffix
 $TEMP = EnvGet("TEMP")
 $VBS_Path = $TEMP & "\NameComputer.vbs"
 $Line1 = 'Set env = CreateObject ( "Microsoft.SMS.TSEnvironment")' 
& @CRLF
 FileWrite($VBS_Path, $Line1)
 $Line1 = 'env ("OSDCOMPUTERNAME") = ' & $CompName & @CRLF
 FileWrite($VBS_Path, $Line1)
 $Result = ShellExecuteWait("cscript.exe", $VBS_Path)
 Exit($Result)

I also found that if I was using a 64bit PE then I had to compile a 64bit executable.  Apparently, WinPE doesn't support WOW.

Link to comment
Share on other sites

  • 1 month later...

I'm trying to read a custom task sequence variable in a SCCM 2012 task sequence. Has anyone done this? I can do it in a vb script, just trying to port this to autoit so I can have more functionality.

VB looks like this:      set env = CreateObject("Microsoft.SMS.TSEnvironment")

                                  name = inputbox( prompt for name)

                                  env("OSDComputerName") = Name

Thanks for any help with this.

The vb code is just an example.

 

Hello Rayray

Try this

$Var = "NAME OF VARIABLE"
$SCCM = ObjCreate("Microsoft.SMS.TSEnvironment")
$VarResult = $SCCM.Value($Var)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...