How to migrate specific user profiles with Configuration Manager

 Some time ago I realized that “User accounts” tab in the “New Computer Association” dialog box has no effect on the “scanstate” command, which “Capture User State” Task Sequence step calls. I did some digging on the internet but i couldn’t find an answer. Maybe somebody just forget to implement it, or something like that :)

So I started looking for a different approach. I found a solution in the “OSDMigrateAdditionalCaptureOptions” task sequence action variable. According to SCCM documentation a value of this variable is automatically added to the “scanstate” command. So you can specify user accounts to migrate with the /ui (user include) parameter. Value of mentioned variable would look like this:  “/ue:** /ui:domainNameuserName /ui:domainNameanotherUserName”. Don’t forget to exclude all users with “/ue:**” parameter first. You can attach the “OSDMigrateAdditionalCaptureOptions” variable to the system resource, for which you want to specify user accounts to migrate.

Since, the value of the variable specifying user acounts to migrate, should be as simple as possible, I wrote a simple script that transforms semicolon separated user names to “scanstate” parameters. The script will read a value of a TS variable “UsersToMigrate” (which should contain user names separated by semicolon), transform it to “scanstate” parameters and write that to “OSDMigrateAdditionalCaptureOptions” task sequence action variable. You have to add additional “Run Command Line” task sequence step right before the “Capture User State” step in the task sequence and configure it to run the following script with “cscript.exe”, to use this approach.

 1: Const USERS_TS_VAR_NAME = "UsersToMigrate"

 

 2:

 

 3: Set objOsdEnv = CreateObject("Microsoft.SMS.TSEnvironment")

 

 4:

 

 5: WScript.Echo "Reading variable """ & USERS_TS_VAR_NAME & """"

 

 6:

 

 7: strUsers = objOsdEnv(USERS_TS_VAR_NAME)

 

 8:

 

 9: WScript.Echo "The value is: """ & strUsers & """" & vbCrlf

 

 10:

 

 11: arrUsers = Split(strUsers, ";")

 

 12:

 

 13: strCmdLine = "/ue:**"

 

 14:

 

 15: numItems = 0

 

 16: WScript.Echo "Parsing users..."

 

 17: For Each user In arrUsers

 

 18:     WScript.Echo "Found user: " & user

 

 19:     strCmdLine = strCmdLine & " /ui:*" & userVariable ""OSDMigrateAdditionalCaptureOptions"" set to: """ & strCmdLine & """"OSDMigrateAdditionalCaptureOptions") = strCmdLineNo users found. OSDMigrateAdditionalCaptureOptions will not be set."

 

 20:     numItems = numItems + 1

 

 21: Next

 

 22:

 

 23: WScript.Echo vbCrlf

 

 24:

 

 25: If numItems <> 0 Then

 

 26:     WScript.Echo "

 

 27:     objOsdEnv("

 

 28: Else

 

 29:     WScript.Echo "

 

 30: End If

 

You can than specify users to migrate with a TS variable “UsersToMigrate” attached on the “System resource” object in the SCCM console.

There is another thing I found out. In the “Capture User State” TS step you have to use the option “Customize how user profiles are captured”, because the other one adds “/ui:all” parameter to the “scanstate” command which isn’t compatible with the scanstate parameters defined in our variable. In this case, we have to specify the xml files we want “scanstate” to use. If we don’t, all will work fine but no data will migrate. Just specify the default ones and that’s it.

It’s not a brilliant solution, but it is the only way to specify which user profiles the “Capture User State” TS step migrates.

However, the question still remains : What “User accounts” tab in the “New Computer Association” dialog box is for?

Leave a Reply