Skip to main content

How do you backup Windows 7 and Windows Vista stand-alone machines using Robocopy?

Both Windows 7 and Windows Vista include Robocopy.  The following batch file copies all data from all standard data locations for the Current User to a UNC Path on the network.

backup.cmd:

@ECHO OFF
CLS
FOR /F "TOKENS=2-4 DELIMS=/ " %%A IN ('DATE /T') DO (SET MYDATE=%%A-%%B-%%C)
SET LOG="\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\backup.log"

ECHO This batch file is intended for use with Windows Vista and Windows 7.
ECHO.
ECHO Copies data from Current User Account to Server.
ECHO.
ECHO If there is more than one user account on this computer, you will need to login
ECHO to each user account and then run this batch file.
ECHO.
ECHO You will need to Show All Hidden Files and Folders and Unhide All Protected
ECHO Operating System Files when restoring this backup from Server.
ECHO.
ECHO All programs must be closed prior to executing this script.  This script will
ECHO not backup an open file.
ECHO.
ECHO Please confirm that there is no data in the following Backup Destination.
ECHO.
ECHO Backup Destination:
ECHO \\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%
ECHO.
ECHO Backup Log Location:
ECHO \\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\backup.log
ECHO.
ECHO When ready to proceed with automated backup, please hit any key.
ECHO.
PAUSE


@ECHO ON

MKDIR "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\"

ECHO BEGIN LOG > %LOG%

ROBOCOPY "C:\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\C ROOT" /XA:HS /ETA /R:0 /LOG+:%LOG% /TEE

ATTRIB -S -H -R "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\C ROOT"

ROBOCOPY "%USERPROFILE%\DESKTOP\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\DESKTOP" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%USERPROFILE%\DOCUMENTS\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\DOCUMENTS" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%USERPROFILE%\PICTURES\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\PICTURES" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%USERPROFILE%\MUSIC\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\MUSIC" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%USERPROFILE%\FAVORITES\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\FAVORITES" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%USERPROFILE%\DOWNLOADS\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\DOWNLOADS" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%LOCALAPPDATA%\MICROSOFT\WINDOWS MAIL\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\MICROSOFT\WINDOWS MAIL" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%USERPROFILE%\CONTACTS\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\CONTACTS" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%LOCALAPPDATA%\MICROSOFT\WINDOWS LIVE MAIL\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\MICROSOFT\WINDOWS LIVE MAIL" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%LOCALAPPDATA%\MICROSOFT\WINDOWS LIVE\CONTACTS\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\MICROSOFT\WINDOWS LIVE\CONTACTS" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%LOCALAPPDATA%\MICROSOFT\OUTLOOK\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\MICROSOFT\OUTLOOK" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%USERPROFILE%\DOCUMENTS\OUTLOOK FILES\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\OUTLOOK FILES" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%%APPDATA%\MOZILLA\FIREFOX\PROFILES\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\FIREFOX\PROFILES" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "%APPDATA%\THUNDERBIRD\PROFILES\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\THUNDERBIRD\PROFILES" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\PROGRAM FILES\INTUIT\QUICKBOOKS\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\QUICKBOOKS" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\DRIVERS\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\DRIVERS" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\NVIDIA\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\NVIDIA" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\INTEL\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\INTEL" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\DELL\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\DELL" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\DOWNLOADS\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\DOWNLOADS" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\WINDOWS.OLD\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\WINDOWS.OLD" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\WINDOWS.OLD.000\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\WINDOWS.OLD.000" /E /ETA /R:0 /LOG+:%LOG% /TEE

ROBOCOPY "C:\WINDOWS.OLD.001\." "\\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%\WINDOWS.OLD.001" /E /ETA /R:0 /LOG+:%LOG% /TEE


ECHO.
ECHO.
ECHO.
ECHO The backup has completed.  Please review the Backup Destination.
ECHO.
ECHO Backup Destination:
ECHO \\SERVER\INSTALL\CUSTOMER BACKUPS\%MYDATE%\%USERNAME%
ECHO.
ECHO If there is more than one user account on this computer, you will need to login
ECHO to each user account and then run this batch file.
ECHO.
ECHO You will need to Show All Hidden Files and Folders and Unhide All Protected
ECHO Operating System Files when restoring this backup from Server.
PAUSE

Comments

Popular posts from this blog

Access Denied (policy_denied). Your system policy has denied access to the requested URL. For assistance, contact your network support team.

While browsing the internet, you may encounter the message: "Access Denied (policy_denied).  Your system policy has denied access to the requested URL.  For assistance, contact your network support team."   This message indicates the internet traffic is being filtered.  The most common source of an internet traffic filter is in corporate environments that use a proxy server or a firewall appliance designed to filter web traffic.  Some businesses are configured as satellite locations using a VPN tunnel.  In these configurations, the VPN may be configured to filter internet traffic.  In rare instances, the Internet Service Provider is filtering internet traffic.  Typically though, your IT Department or a Network Management Team has configured your internet traffic to be filtered.  Isolating Source of Web Filtering In an environment that is unmanaged and the source of the filtering is unknown, following are some steps you may wish to peform: Th...

How do you stop an unstoppable Windows Service?

You may encounter a Windows Service in Services that has the buttons for Start, Stop, Pause and Resume greyed out.  If you attempt to stop the Service using sc stop [servicename], you encounter the error message: "The requested control is not valid for this service."  To resolve this issue, please perform the following steps: Click Start - Control Panel - Administrative Tools - Services. Double-click the relevant Service. Change the Service Start-Up Type to Disabled. Click Apply. Click OK. Hit CTRL-ALT-DEL on your keyboard. Select Task Manger. Perform an End Task on the relevant Service. This issue has been resolved. http://www.smartnetadmin.com

The L2TP connection attempt failed because the security layer encountered a processing error during initial negotiations with the remote computer.

You may encounter the following error message when using the L2TP/IPSec VPN Client that is native to the Windows Operating System: "The L2TP connection attempt failed because the security layer encountered a processing error during initial negotiations with the remote computer."  This error message typically occurs when you are using the wrong Pre-Shared Key for your L2TP VPN.  This error message can occur when other components of your configuration are incorrect but the first thing to confirm is that you are using the correct Pre-Shared Key. If you are using the wrong Pre-Shared Key, the L2TP VPN connection will say Connecting for a long period of time and then display the error message: "The L2TP connection attempt failed because the security layer encountered a processing error during initial negotiations with the remote computer." If you are using the wrong username or password, the L2TP VPN will immediately respond with: "The remote connection was denied b...