Echo off @if not "%ECHO%"=="" echo %ECHO% @if not "%OS%"=="Windows_NT" goto DOSEXIT rem $Author Mark Hazel rem $Workfile: ProfileBat.bat $ $Revision:1 $ $Date: 7/9/2012 $ rem $Archive: \\ssdrocsna2\L240186$ rem $This procedure is an attempt to create and copy the users profile and data directorys to a structured logical location for archival and restoration purposes. rem $Create the Machinename-ProfileName-Date directory on the Transfer Share under the Hazel subdirectory. (MKUSERDirs) rem Usage ProfileBack.bat workstation ProfileName rem Set local scope and call MAIN procedure setlocal & pushd & set RET= set SCRIPTNAME=%~n0 set SCRIPTPATH=%~f0 if "%DEBUG%"=="1" (set TRACE=echo) else (set TRACE=rem) call _mtplib :INIT %SCRIPTPATH% if /i {%1}=={/help} (call :HELP %2) & (goto :HELPEXIT) if /i {%1}=={/?} (call :HELP %2) & (goto :HELPEXIT) call :MAIN %* :HELPEXIT popd & endlocal & set RET=%RET% goto :EOF rem ///////////////////////////////////////////////////////////////////////// rem HELP procedure rem Display brief on-line help message rem :HELP if defined TRACE %TRACE% [proc %0 %*] rem Put help message here... goto :EOF rem ///////////////////////////////////////////////////////////////////////// rem ///////////////////////////////////////////////////////////////////////// rem Declare and reset variables set computername= set Drivename= rem ///////////////////////////////////////////////////////////////////////// rem MAIN procedure @echo off :MAIN if defined TRACE %TRACE% [proc %0 %*] rem Put main script code here... rem //////////////////////////////////////////////////////////////////////////////// Echo off CLS rem PING 1.1.1.1 -n 10 -w 10 >NUL rem net use x: /delete rem //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// rem color is Green color 2 :MKUserDirs Echo Machine is %1 Echo User is %2 Set mm=%DATE:~4,2% Set dd=%DATE:~7,2% Set yyyy=%DATE:~10,4% Echo date is %YYYY%-%mm%-%dd% Echo dir will be %1-%2-%mm%-%dd%-%yyyy% Pause REM Map to the transfer shares and create the user directorys /////////////////////////////////////////////////////////// REM Color is TEAL color 3 net use T: /delete net use T: \\ssdrocsapp30\transfer sleep 2 mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy% Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2 Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\Cookies Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\DeskTop Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\Favorites Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\"My Documents" Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\NetHood Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\PrintHood Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\Data\Notes Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\Data\users\%2 Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\Temp Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\"Application Data"\Microsoft\Outlook Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\"Local Settings"\"Application Data"\Microsoft\Outlook Mkdir T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\DATA sleep 2 pause Rem Map to the users Machine/////////////////////////////////////////////////////////////////////////////////////////////// REM Color is RED Color 4 net use W: /Delete Net use W: \\%1\c$ echo we are using %1 client drive pause REM Copy the files from the users machine to the transfer share directories REM Color is Yellow Color 6 cd w: xcopy /C /Y /H W:\"Documents and Settings"\%2\"Application Data"\Microsoft\Outlook\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\"Application Data"\Microsoft\Outlook xcopy /C /Y /H W:\"Documents and Settings"\%2\"Local Settings"\"Application Data"\Microsoft\Outlook\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\"Local Settings"\"Application Data"\Microsoft\Outlook xcopy /C /Y /H W:\"Documents and Settings"\%2\ntuser.dat T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\ sleep 2 xcopy /C /Y /H /E W:\"Documents and Settings"\%2\cookies\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\Cookies xcopy /C /Y /H /E W:\"Documents and Settings"\%2\Desktop\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\Desktop xcopy /C /Y /H /E W:\"Documents and Settings"\%2\favorites\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\Favorites xcopy /C /Y /H /E W:\"Documents and Settings"\%2\"My Documents"\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\"My Documents" xcopy /C /Y /H /E W:\"Documents and Settings"\%2\NetHood\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\Nethood xcopy /C /Y /H /E W:\"Documents and Settings"\%2\PrintHood\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\"Documents and Settings"\%2\PrintHood xcopy /C /Y /H /E W:\Data\Notes\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\\Data\Notes\ xcopy /C /Y /H /E W:\Data\users\%2 T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\\Data\users\%2 xcopy /C /Y /H /E W:\Temp\*.* T:\hazel\%1-%2-%mm%-%dd%-%yyyy%\Temp\ dir \\%1\c$:\"program files" /B>T:\hazel\ssdrocwKCGN78F-westbroo-07-19-2012\apps.txt Pause :end :EOF