A Windows User Profile is the files and directories that contain the user-specific data that define the user’s working environment. This data can include display settings, application settings, printer connections, mouse/keyboard settings and network connections. When a new user logs onto a computer, a profile is created automatically. While a user is logged on, changes made to the desktop environment are saved to their user profile. Local User Profiles are the default profile type in a Windows environment. The user profile files and folders are stored on the local machine’s hard drive.
A user profile consists of:
- A registry hive that is essentially a database that stores the user-specific settings. This registry hive is stored in the NTUSER.DAT and USRCLASS.DAT files.
- A set of folders that are stored in a per-user directory. Applications and other operating system components populate this user folder with subfolders and user-specific data, such as start menu items, desktop shortcuts, configuration files, startup applications.
The following script backups up a Windows 2003 (and below) local profile hive to a flat-file in the c:\ntbackups directory which can then be sent to TSM Server using the standard dsmc command. It is a good idea to leverage the TSM Client options prenschedulecmd or preschedulecmd to run this before the start of a backup.
:: ---------------------------------------------------------------------------------------
setlocal
set ntbackup_dir=c:\asm\tivoli\tsm\baclient\ntbackups
setlocal
set ntbackup_dir=c:\asm\tivoli\tsm\baclient\ntbackups
mkdir %ntbackup_dir%
pushd %ntbackup_dir%
cmd /u /c dir c:\ntuser.dat /s /b /ah > %ntbackup_dir%\tsmback.bks
cmd /u /c dir c:\ntuser.dat /s /b >> %ntbackup_dir%\tsmback.bks
cmd /u /c dir c:\usrclass.dat /s /b >> %ntbackup_dir%\tsmback.bks
cmd /u /c dir c:\usrclass.dat /s /b /ah >> %ntbackup_dir%\tsmback.bks
%systemroot%\system32\ntbackup.exe backup "@%ntbackup_dir%\tsmback.bks" /j "TSM Export: User Profiles" /f "%ntbackup_dir%\ntbackup.bkf"
pushd %ntbackup_dir%
cmd /u /c dir c:\ntuser.dat /s /b /ah > %ntbackup_dir%\tsmback.bks
cmd /u /c dir c:\ntuser.dat /s /b >> %ntbackup_dir%\tsmback.bks
cmd /u /c dir c:\usrclass.dat /s /b >> %ntbackup_dir%\tsmback.bks
cmd /u /c dir c:\usrclass.dat /s /b /ah >> %ntbackup_dir%\tsmback.bks
%systemroot%\system32\ntbackup.exe backup "@%ntbackup_dir%\tsmback.bks" /j "TSM Export: User Profiles" /f "%ntbackup_dir%\ntbackup.bkf"
:: ---------------------------------------------------------------------------------------