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...

Event ID: 7001 - Source: VSS - Unable to create a shadow copy

When using Microsoft Windows Server, you may encounter the error message: "Unable to create a shadow copy."  In the Event Viewer, you may find the following Event: "Event ID: 7001 - Source: VSS - Unable to create a shadow copy."  This event involves the Volume Shadow Copy Service (VSS).  Most likely the Server was rebooted while creating a Shadow Copy.  Many websites describe deleting or renaming the C:\WINDOWS\SYSTEM32\WBEM directory used by Windows Management Instrumentation to resolve this issue.  This is not correct.  Following are the steps to resolve this issue: Double-click My Computer. Right-mouse click the Hard Drive causing the problem. Click the Shadow Copies tab. Select the appropriate Volume. Click Disable. Click OK. Click Start - Control Panel - Administrative Tools - Scheduled Tasks. Delete all tasks related to the Volume Shadow Copy Service. Reboot the Server. Double-click My Computer. Right-mouse click the Hard Drive causing the problem. Cl...

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