Computers are great at repetitive tasks whereas humans get bored and might skip some steps every now and then. This was the exact situation I found myself in while doing machine replacements. Every time I sit down to replace a machine, I would end up copying the same things from a user’s machine and writing down the same info in order to transfer things to the new machine. In the case of local profiles (instead of roaming profiles), there are many settings stored on the terminal’s hard drive that, if you can transfer, makes the whole process much more pleasant and less of a headache for all involved (especially the IT).
Some things you’ll want to remember:
Firefox profile, IE Favorites, Thunderbird profile, Quick Launch, User’s Desktop, All Users’ Desktop, Voyager templates and such, Voyager preferences, OCLC Connexion settings, ODBC Settings, mapped drives, local administrators, and Printers.
With that many things to copy every single machine, it makes sense to have a reliable script to run that can automate the process and ensure that you haven’t missed any of the basics. Of course, you’ll still want to analyze and see if there are any other custom applications to add to the list, but the above covers the majority of our users and their work relevant files. All the files are copied to the users home directory, a share on our servers tied to the individual. This keeps it independent of the hard drive, so in case of a crash, you still have the files, and having to copy from a local folder to a network share in case of a machine replacement defeats the purpose of scripting out the process.
Below you’ll see the code for our current back-up script. It takes advantage of some of the things I’ve posted about previously like the Print Migrator and the Run As… tool lsrunase. The Run as… is used to access files or configurations that the normal user doesn’t have access to. Since it is under a different user, files can not be accessed via the %userprofile% or copied to the user’s home directory. These are stored at some location on the local drive and then copied over to the home directory (mapped as H drive) as the regular user. I made a quick executable that deletes these files from their temporary location just to avoid cluttering up any machines. This is also run as the Admin account to ensure proper access to delete the files.
@echo off
cls
@REM \serversoftwareBackup ScriptsBackup08.bat
if not exist h:backup08 mkdir h:backup08
@REM Printers backup
"\serversoftwarebackup scriptslsrunase.exe" /user:PrinterBakUsr /domain:Domain /password:EnCrYpTeDpAsSwOrD /runpath:\serversoftwarewindows /command:"printmig.exe -b c:printers.cab"
@REM Mozilla/Firefox backup (without cache files and .lock (open)
\serversoftwarewindowsrobocopy "%userprofile%application dataMozilla" h:backup08Mozilla /e /xf *cache* *.lock /xd *cache*
@REM IE Favorites backup
\serversoftwarewindowsrobocopy "%userprofile%Favorites" h:backup08Favorites /e
@REM Thunderbird profile backup
\serversoftwarewindowsrobocopy "%userprofile%application dataThunderbird" h:backup08Thunderbird /e /xf *.lock
@REM OCLC backup
\serversoftwarewindowsrobocopy "%userprofile%application dataOCLC" h:backup08OCLC /e
@REM Quick Launch toolbar backup
\serversoftwarewindowsrobocopy "%userprofile%Application DataMicrosoftInternet ExplorerQuick Launch" "h:backup08Quick Launch" /e
@REM Desktop backup
\serversoftwarewindowsrobocopy "%userprofile%desktop" h:backup08desktop /e
@REM All Users Desktop backup
\serversoftwarewindowsrobocopy "c:documents and settingsall usersdesktop" "h:backup08All users desktop" /e
@REM Voyager backup for templates and such
\serversoftwarewindowsrobocopy c:voy2k1g h:backup08voy2k1g /e
@REM Voyager preferences export
"\serversoftwarebackup scriptslsrunase.exe" /user:PrintBakUsr /domain:Domain /password:EnCrYpTeDpAsSwOrD /runpath:\serversoftwarewindows /command:"
regedit /e "%userprofile%voyager.reg" "HKEY_CURRENT_USERSoftwareVB and VBA Program Settings"
copy "%userprofile%voyager.reg" h:backup08
@REM ODBC Settings export
regedit /e "%userprofile%ODBC.reg" "HKEY_LOCAL_MACHINESoftwareODBCODBC.ini"
copy "%userprofile%ODBC.reg" h:backup08
:The Printers
@REM loop to make sure print migrator has completed
if not exist c:printers.cab goto Printers
copy c:printers.cab h:backup08
"\serversoftwarebackup scriptslsrunase.exe" /user:PrintBakUsr /domain:Domain /password:EnCrYpTeDpAsSwOrD /runpath:"\serversoftwarebackup scripts" /command:"cleanup.exe"
@REM small exe to delete the c:printers.cab, Voyager.reg, ODBC.reg as a cleanup@REM List mapped drives
net use > H:backup08drives.txt@REM List Local Admins
net localgroup Administrators > H:backup08admins.txt
cls
@echo Backups have been completed for Mozilla/Firefox, IE Favorites, Thunderbird, OCLC, Voyager, and Desktop, if necessary
pause