Jump to content

Migrating User Profiles


savj14
 Share

Recommended Posts

I have a working script to help users join a domain. I can almost migrate their profiles except there is a little issue. Here is what my script currently does:

1. User is logged into local machine and the script will add the user to the new domain automatically.

2. It will then automatically restart the machine.

3. The script is setup then to auto login locally using the Administrator account.

4. At the startup a second script will run which will prompt for the Username

5. The user will input their local user name and it will copy their files into a new folder for the domain

a. For example say User1 is a local user. And the new domain is Testdomain.local

The following would happen:

C:\Documents and Setting\User1 would be copied to C:\Documents and Settings\User1.Testdomain

6. The script then reboots when finished copying. The Auto Login will be disabled and the User will log into the domain with their migrated profile.

Now the issue is C:\Documents and Settings\User1.Testdomain would normally be created the first time User1 logged into the domain. But since it is already created during the script, the first time the user logs in it created a new folder instead of using C:\Documents and Settings\User1.Testdomain that was created using the script. It uses something like C:\Documents and Settings\User1.Testdomain001 or something similar.

Is there are way to prevent this?? Or possibly a better way to go about migrating the profiles??

I have come so close and am hoping there is a registry setting that will force the user to use the created Folder instead of making a completel new one on login.

Link to comment
Share on other sites

the first time the user logs in it created a new folder instead of using C:\Documents and Settings\User1.Testdomain that was created using the script. It uses something like C:\Documents and Settings\User1.Testdomain001

Is there are way to prevent this??

I dont think there is a way of preventing windows for recreating the user profile. I did a profile magrition at work and as a work around the script login as administrator and use _FileListToArray() to get an array of all the folders at Documents and Settings. After asking for the username and password I use RunAsSet() which by default load (create) the user profile, then I use again _FileListToArray() to create another array. Compare Array2 to Array1 and the extra folder is the new user profile. Now you can copy the old user profile into the new profile.
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

I dont think there is a way of preventing windows for recreating the user profile. I did a profile magrition at work and as a work around the script login as administrator and use _FileListToArray() to get an array of all the folders at Documents and Settings. After asking for the username and password I use RunAsSet() which by default load (create) the user profile, then I use again _FileListToArray() to create another array. Compare Array2 to Array1 and the extra folder is the new user profile. Now you can copy the old user profile into the new profile.

I'm not sure I am following what you are saying. Can you PM me the script you used so I can see if it would help me?? I would appreciate it.

I have worked too hard to just scrap my script now, so I hope I can get around this bump in the road. :)

Link to comment
Share on other sites

Here is an example of what I mean:

#include <File.au3>
#include <Array.au3>

Opt("ExpandEnvStrings", 1)

Dim $ProfileList, $NewProfile
Local $ProfilesPath = RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", "ProfilesDirectory")

$ProfileList = _FileListToArray($ProfilesPath, "*", 2)
While 1
    $UserName = InputBox("UserName", "Enter UserName")
    If @error = 1 Then Exit
    $Password = InputBox("Password", "Enter Password", "", "*")
    If @error = 1 Then Exit
    If $UserName <> "" And $Password <> "" Then ExitLoop
    MsgBox(16,"Error","You have to enter username and password or press cancel to exit script.")
WEnd
RunAsSet($UserName, "Your Domain Name", $Password, 1)

$NewProfile = _FileListToArray($ProfilesPath, "*", 2)
For $x = 1 To $NewProfile[0]
    If _ArraySearch($ProfileList, $NewProfile[$x], 1) = -1 Then
        $NewProfile = $ProfilesPath & "\" & $NewProfile[$x]
        ExitLoop
    EndIf
Next

MsgBox(64,"NewProfile","This is the path for the new user profile:" & @CRLF & @CRLF & $NewProfile)
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...