Chat now with support
Chat with Support

Migration Manager for AD 8.14 - Resource Kit User Guide

Using ChangeProfile

Using ChangeProfile

ChangeProfile uses the following command line syntax:

ChangeProfile.exe IniFileFull

where IniFileFull is the full path to the parameter file. The format of the parameter file is described in the Format of the ChangeProfile Parameter File topic.

The program accepts either a full UNC path to the parameter file or a relative path. If the file is specified in relative format, ChangeProfile assumes the file is located in the Windows directory—not in the current directory. To work around this limitation, use the following syntax from a logon script or a batch file:

ChangeProfile.exe %0\..\IniFile

Or use the following syntax from the command line:

ChangeProfile.exe .\IniFile

Examples

> ChangeProfile.exe ChangeProfile.ini
> ChangeProfile.exe %LOGONSERVER%\READ_SHARE\
ChangeProfile.ini

If some of the parameters are not specified in the INI file, the default settings are used. When the program runs with its default settings, it does the following, depending on the number of old SIDs found in the SIDHistory:

Number of Old SIDs Description
number of old SIDs = 0 Marks execution in the registry and quits.
number of old SIDs = 1 Changes the link to the found profile, marks execution and performs an immediate logoff.
number of old SIDs > 1 Marks execution in the registry and quits.

Marking of the execution is accomplished by setting two keys in the registry:

[HKEY_CURRENT_USER\Software\Aelita\RegUtil\ChangeProfile]
AttempNumber=Number of last attempt

and

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\
CurrentVersion\ProfileList\TextSID] MiniProfileMigration=1

Another tool (ExportProfile) sets the value of MiniProfileMigration to 2.

When the link is successfully changed, the program sets the value of AttemptNumber to the value given in the parameter file and saves the old link under a new value called ProfileImagePath.BAK. An administrator or a power user could revise this value to locate the old profile folder and remove the folder to clear disk space being occupied by unused profiles.

If the link to the new (migrated) account is not successfully changed, the AttemptNumber value is increased by 1. When it reaches the maximum value contained in the parameter file, the program stops attempting to change the profile link.

Format of the ChangeProfile Parameter File

Format of the ChangeProfile Parameter File

[Task]
DisableLogoff={0|1}
DisableMessage={0|1}
LogoffMessage=Message text
LogoffMessageYN={0|1}
OnDuplicatedSid=URL
TryToLoadProfile={0|1}
DialogPosX=number
DialogPosY=number
SelectProfile={0|1}
SleepTime=number
LogoffTimeout=number
AttemptNumber=number
LogFileName=%LOGONSERVER%\WRITE_SHARE\ChangeProfile.log

Explanation:

Parameter Description
DisableLogoff

One of the following:

0 - Initiate logoff after the profile link has been changed. This is the default.

1 - Do not initiate logoff, even if the profile link has been changed for the currently logged-on account.

DisableMessage=0

One of the following:

0 - Display a message box prompting for a logoff if the profile link has been changed successfully. This is the default.

1 - Do not show a message box prompting for a logoff, even if the profile link has been changed successfully.

LogoffMessage=…

One of the following:

0 - Include an OK button in the message box. If this parameter is 0, the DisableLogoff parameter is ignored. This is the default.

1 - Include Yes and No buttons in the message box. Logoff occurs only if the user clicks Yes.

OnDuplicatedSID=URL

Use the URL address specified if there are duplicates in SIDHistory (this is considered to be an error if SelectProfile is set to 0 and no profile re-mapping is done.) By default the value of OnDuplicatedSID is empty.

TryToLoadProfile=0

One of the following:

0 - Bypass loading the profile before changing the profile link. This is the default.

1 - Load the profile using the RegLoadHive API before changing the profile link. The link will be modified only if the profile can successfully be loaded. See the Remarks topic.

DialogPosX=N Set the horizontal coordinate in pixels of the top-left corner of the dialog boxes to be shown to N. The default is 0.
DialogPosY=N Set the vertical coordinate in pixels of the top-left corner of the dialog boxes to be shown to N. The default is 0.
SelectProfile=0

One of the following:

0 - Treat duplicates in SIDHistory as an ambiguous situation and forward the user to the URL given in the OnDuplicatedSID parameter. This is the default.

1 - Show a select dialog box allowing the user to pick one of the available old profiles to set as the current profile if there are duplicates in SIDHistory.

SleepTime=N

Wait N seconds before either showing a logoff message box or logging off, depending on other settings.

The default is 0.

LogoffTimeout=N

Have the logoff prompt dialog box wait N seconds for the user to confirm his or her choice. After the time elapses the logoff is performed.

The default is 0.

AttemptNumber

The program will attempt to run for the same account this number of times. After each run the program increases its own counter in the registry and stops when the value given in this parameter is reached. If the program is successful, it sets the counter in the registry to this value directly.

The default is 0.

LogFileName

The ERRORLEVEL code description will be written to this file. This parameter can contain environment-variable strings to dynamically control the location of the log file. For example:

%LOGONSERVER%\WRITE_SHARE\ ChangeProfile.log

%UserProfile%\ChangeProfile.log

If the %LOGONSERVER% variable is not supported, then you can specify a path to a share with write access (same for all domain controllers). The logon server will be resolved from the %PATH% system variable of the custom add-in and added to the beginning of the LogFileName. Use the following command:

LogFileName=WRITE_SHARE\ChangeProfile.log

Parameter File Example

Below is an example of a ChangeProfile.ini file:

[Task]
DisableLogoff=1
DisableMessage=0
LogoffMessage="Please log off or restart your computer"
LogoffMessageYN=0
;OnDuplicatedSid=URL
TryToLoadProfile=0
DialogPosX=150
DialogPosY=150
SelectProfile=1
SleepTime=10
LogoffTimeout=40
AttemptNumber=5
LogFileName=\\server\share\ChangeProfile\
ChangeProfile.log

ChangeProfile Return Codes

ChangeProfile Return Codes

The following program return codes are set depending on the work results.

Return Code Description
-2 Exception raised.
-1 Unknown error.
0 No links to an old profile were found.
1 Not a Windows NT/2000 OS.
2 Subsequent run for the same profile.
3 Duplicate SIDs exist in SIDHistory.
4 Profile link has been modified. User refused to logoff when prompted.
5 Profile link has been modified followed by user logoff.
6 Error while using registry API.
7 New and old SIDs already use the same profile.
8 Cannot load profile with TryToLoadProfile set to 1.
9 MiniProfileMigration value is set for this profile.
10 Error while calling the API functions.
11 Link to the profile has been changed with no logoff because it is disabled in the parameter file.
12 Argument (INI) file not found.
13 User canceled selection of profile.

Format of the ChangeProfile Log File

Format of the ChangeProfile Log File

The log file contains records for each run. The fields of each record are tab-delimited.

The records contain the following data:

Hour:Minutes:Seconds
Day/Month/Year
Computer
Account
Profile
SIDsInHistory
Error

where Profile is the logon profile of the Account and Key is the key in the registry for the migrated account.

A log file indicating the result of a run is created on the target workstation. The path of the log file is as follows:

%SystemRoot%\system32\Computer Renamer Log.txt
Related Documents