DOWNLOAD THE CODE:
Download the Code 93463.zip

The two lines of code after callout B determine the location of the Windows folder on the remote PC. This check is necessary to execute Sysinternals' PsExec (http://www.sysinternals.com/utilities/psexec.html), a free utility that lets you run programs on a remote PC from your local computer. By default, this utility runs from the remote PC's local Windows directory (e.g., C:\winnt\system32).

After obtaining the location of the local Windows directory, SavePC.bat copies several files to that directory, including the files needed to run KiXtart (.kix) scripts and SavePC.bat's three supporting scripts: SaveProfile.bat, DelTempFiles.vbs, and SavePC.kix. The code at callout C uses PsExec to run SaveProfile.bat, which first executes DelTempFiles.vbs. Del-TempFiles.vbs deletes each profile's temporary files as well as some folders that house those files. SaveProfile.bat then executes SavePC.kix, SavePC.kix backs up the relevant profile registry keys and saves the information in a file named ProfileList.reg.

After the supporting scripts run, SavePC.bat backs up the remote PC's profiles and the profile settings. As the code at callout D in Listing 1 shows, SavePC.bat uses the Microsoft Windows Server 2000 Resource Kit's Robocopy utility to copy the profiles from the remote PC's C:\Documents and Settings folder to the backup folder specified by the BackupFolder variable. You can't use the built-in Xcopy command because it can't copy file and folder permissions. When you copy profiles, you must include the security settings for every file and folder. Unlike Xcopy, Robocopy copies files' and folders' security settings. As the code at callout E in Listing 1 shows, SavePC.bat uses the built-in Copy command to copy the registry's profile settings in the C:\ProfileList.reg file to the backup folder.

When SavePC.bat ends, your backup folder will contain all the profiles (and their permissions) for that remote PC. After you've finished installing the new desktop software, you can restore those profiles.

The Restore Phase
In the restore phase, the Profile-Backup solution first deletes any default profiles that might have been installed when you installed the new OS on the remote PC (such as the ASPNET, AllUsers, and Administrator profiles), then copies the backed up profiles. The deletion of default profiles is necessary to prevent collisions between the current profile registry settings and the backed up registry settings.

Although I restored the profiles on the same PC from which I copied them, you can also restore the profiles on another PC. In that case, you need to rename the backup folder on the network share, giving it the name of the remote computer to which you want to restore the profiles. Whether you're restoring the profiles on the same PC or another PC, that PC's user can't be logged on during the restoration-process. Listing 2 shows CopyPC .bat, the main script in the restore phase. The script begins by warning you that it will eliminate all the profiles on the specified remote PC, then asks you to press any key to acknowledge that you want to do so. I added this feature to eliminate the risk of restoring the profiles on the wrong PC.

After setting the BackupFolder variable's value to the backup folder's UNC path (see callout A in Listing 2) and determining the location of the Windows folder, CopyPC.bat uses Delprof.exe to delete any default profiles that might have been installed when you installed the new OS. Then, as callout B in Listing 2 shows, the script uses Robocopy to copy the profiles data from the backup folder to the remote PC's C:\Documents and Settings folder.

As callout C in Listing 2 shows, CopyPC.bat copies to the remote PC's Windows folder all the files it needs to restore the registry settings. Those files include RestoreRegistryProfile.bat, CopyPC.kix, and ProfileList.reg. CopyPC.bat uses PsExec to run RestoreRegistryProfile.bat. RestoreRegistryProfile.bat executes CopyPC.kix, which uses ProfileList.reg to write the necessary profile settings to the registry.

Running the Solution
You can find the ProfileBackup solution (ProfileBackup.zip) on the Windows Scripting Solutions Web site. (See page 1 for download information.) After you download ProfileBackup.zip, extract all the files. The files will automatically be placed in two folders—Backup and Restore—which will be in a folder named ProfileBackup.

Prev. page     1 [2] 3     next page



You must log on before posting a comment.

If you don't have a username & password, please register now.

Reader Comments

1. We seem to be missing three of the "supporting scripts", SaveProfile.bat, DelTemFiles.vbs, and SavePC.kix.

2. Does this work only work when the domain is the same?

3. Give us a break with the image text, you're presenting characters that aren't on the keyboard, do we ignore them, use what's close?

Jeff

lospinoj

Article Rating 2 out of 5

Where are the supporting scripts??

netdirtech

Article Rating 3 out of 5

Hi Jeff and netdirtech! I'm Simon, the author of the article. I see that there was some problem with publication of support scripts. I've contacted already Windows Scripting Solutions stuff to replace current zip file with the correct one, but for now, you can contact me freely by mail, simonz@extreme.co.il, and I'll provide you all the scripts needed for the solution.

As for the questions: I didn't test migrating solution across many domains, but I think it will work with the following conditions are true: if there is a dual trust between participating domains(so you can access each participating computer from another); user, running the scripts is administrator of both computers participating in the migration. As for the image text, I am sorry, but I don't understand what do you mean. Please, contact me by mail and I'll try to solve the problem.

Best wishes, Simon Zeltser.

simon130

Article Rating 4 out of 5

very nice

nickjo67

Article Rating 5 out of 5

Hi Simon,

I already send you an e-mail to ask if you could send me the zip file with the files needed for the solution. Could you please do do.

Thanks in advance Martin

mvanhautte

Article Rating 4 out of 5

Great setup Simon. Have you had any response from the website re: uploading the proper script package?

jeremyschubert

Article Rating 4 out of 5

Due to a production error, all of the downloadable files for this article weren't originally available. This problem has been corrected. Sorry for any inconvenience this might have caused.

chumphries@penton.com

Article Rating 5 out of 5

Article was getting useful but then it stops ( Because I needed to migrate the profiles on remote machines, using the wizard wasn't an option. . . .). Where is the rest of the article ?

tbkc3

Article Rating 3 out of 5

Good!

spneo

Article Rating 4 out of 5

Like the soution, very easy to understand what happens in each phase.

perezjonestsisah@yahoo.com

Article Rating 4 out of 5

the Listenings and the download code links are not working

TauberC

Article Rating 4 out of 5

ditto on the download code links. They aren't working.

tstam69

Article Rating 4 out of 5

What happened to the rest of this article? Is this a teaser or trailer? Can someone please repost this along with the scripts?

fengandy@yahoo.com

Article Rating 1 out of 5

 
 

ADS BY GOOGLE