SCCM 2007 Variable from VBS Script

Posted on 2011-10-05
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
    LVL 65

    Accepted Solution

    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

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

    Expert Comment

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


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
    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.
    The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
    The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now