SCCM 2007 Variable from VBS Script


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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wyhelpofficerAuthor Commented:
Thanks Rob, I was just specifying the value incorrectly - your modifications worked a treat :)
Great!  Kind of a lucky guess.....glad it worked out!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Server Apps

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.