Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


SCCM 2007 Variable from VBS Script

Posted on 2011-10-05
Medium Priority
Last Modified: 2012-05-12

I am using the following vbs script in an attempt to pass the variable "migrate" into a Task Sequence in SCCM 2007.

Basically, the script asks the user if they wish to run the USMT section of the Task Sequence, with a "yes" or "no" button.

The idea is that when the Task Sequence gets to the USMT group, it will look at the value of the "migrate" variable, and will only run on condition that it equals 1 (i.e. user clicked yes).

Here is the script I have made:

Dim migrate
Set migrate = CreateObject("Microsoft.SMS.TSEnvironment")
If MsgBox ("Is User State Migration Required?", vbYesNo, "USMT Request") = vbYes Then
migrate = 1
migrate = 2
End If

So, the script runs fine and prompts the user correctly, but the Task Sequence does not run the USMT group, even if the user chooses "yes" at the prompt.

I know the USMT group works fine, because it runs if I remove the prompt and condition. So I can only assume that the "migrate" variable is not being passed through to the Task Sequence. (Therefore "migrate" does not equal 1, so the group does not run.)

Could anyone tell me if I have set up the script to pass the variable to the Task Sequence properly, or do I need to somehow create the variable in the TS before defining it in the script?

Hopefully I explained all that well enough!

Also, just one quick secondary question about posting on this site - where is the best place to post SCCM questions, I can't find anything specific in the zones?

Many thanks
Question by:wyhelpofficer
  • 2
LVL 65

Accepted Solution

RobSampson earned 2000 total points
ID: 36921615
Hi, I'm not realy familiar with this, but don't you need to specify the value you're trying to change?  As in, something like this:
Dim TSenv
Set TSenv = CreateObject("Microsoft.SMS.TSEnvironment")
If MsgBox ("Is User State Migration Required?", vbYesNo, "USMT Request") = vbYes Then
TSenv("migrate") = 1
TSenv("migrate") = 2
End If

Open in new window



Author Closing Comment

ID: 36923193
Thanks Rob, I was just specifying the value incorrectly - your modifications worked a treat :)
LVL 65

Expert Comment

ID: 36923451
Great!  Kind of a lucky guess.....glad it worked out!


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question