Automatic backups script for Windows

This information is for those users who wish to automate their Manager data backup.

Windows users can follow this guide.
(The images shown in this guide are from Windows 10 Pro - 64bit OS. So it may vary a bit for other Windows editions)

Part 1 - The first step is to create a script that will automatically backup your business data.

  1. Open Notepad and copy the following script.
echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime  ^| find "."') do set dt=%%a
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%
set stamp=ManagerBackup_%DD%%MM%%YYYY%@%HH%%Min%
mkdir %stamp%
cd %stamp%
xcopy "Your_Manager_Application_Data_Location\*.*" /s
  1. In the above code replace Your_Manager_Application_Data_Location with the location to your Manager application data folder. If you had not change the application data folder, the default location will be C:\Users\Username\AppData\Local\Manager

  2. Now select Save As option under File menu and select All Files (.) as the type.
    image
    Enter any name as file name with the extension .bat

  3. It is always a good practice to save backups in a different drive other than the default C drive where windows is installed because if you had to reinstall windows for any reason, you would most probably end up losing the files stored in your C drive. So create a folder in D or E drive say ManagerBackup and move the batch file created in the above step to this folder.

Now running this file will create a backup of your application data folder contents in the newly created backup folder. Each backup will have a timestamp which help in identifying the backup date and time.
image

Part 2 - The next step is to make this backup run automatically at any specific interval.

  1. In Windows, open the program called Task Scheduler. You can find it under Administrative Tools in the Control Panel.

  2. On the right side you will find the Actions menu. Select Create Basic Task
    image

  3. Enter a name for this task and select Next.

  4. In the next screen select the option When the computer starts. This will trigger the backup process every time your computer starts. Click Next again.
    image

  5. Select Start a program and click Next.
    image

  6. Click Browse and select the script created earlier to proceed further.

  7. In the next screen, the summary of selected actions is shown. Check if everything is correct and click Finish.

Thats it! Now the backup will happen every time you start Windows.

6 Likes

For me that’s about once every few months! :laughing:

Thanks for the guide sharpdrivetek. I use Windows often as well, but wasn’t aware of the Task Scheduler’s existence!

1 Like

Once every few months is ok if the user is responsible. Most small business have different people using the same computer and errors can happen. so having a backup of the file before the user even started a Manager session would help revert back easily.

nifty! I hope it works on windows 7 though. It does backup the whole data folder right?

Task Scheduler has been a feature on all Windows versions. So it will definitely work on 7.

yes.

1 Like

Most people, if not all people are using Manager to manage a business, thus I would recommend a dedicated backup program for the following reasons:

You need to backup all your data, not just manager!

  1. Task Scheduler Backups like this have a major failing in that there is no backup notification. So something could go wrong with the backup causing it to fail and unless you check the logs you would not know for months - usually when you try to restore data. Backup Notification and Backup Restore Verification are very important.

  2. What happens if your computer gets hit by a malware virus like Cryptolocker and encrypts all your data? Then your backup in theory could be encrypted as well if its on the same computer or on a network share that the malware could access.

  3. End of the World Scenario - what happens if your house/office burns down. If your backup is onsite, you have lost everything. Offsite Backup is vital.

  4. Data Protection - Backing up your data offline really requires your backup to be encrypted so that if the server end is hacked, all the data is unreadable.

I thought that I would just raise these points as people unfortunately only come to appreciate a proper backup system only after they have lost data. Most people look at backup as an expense instead of the valuable asset it really is.

I concur, Currently before @sharpdrivetek shared his practices, I’m using syncthing combo with cloud storage sync folder. the only Issue I have the syncthing keeps sync used file ended generate extra copy of incomplete file lol. have to delete once a while.

For additional security you can download Backup and Sync program from google and sync the backup folder created in my above post to your google drive account.
this will help you have a copy of you backups in your Google drive too.
as long as both the user computer and google servers do not burn down simultaneously, your business data will be safe.

@acecombat2 you can follow this too since you run a server.

3 Likes

This is like triple backup, talk about paranoia. :rofl: @sharpdrivetek check ‘syncthing’ out you understand what it means paranoia.

We are using Server version of the Manager.
From the Script I understand that the file at location "C:\Users\Username\AppData\Local\Manager " is being copied to the Folder having the Batch file.
But is the restore procedure for these files the same as the standard procedure.
I tried generating Backup with standard procedure. I then compared the size of that backup file with the one at location “C:\Users\Username\AppData\Local\Manager”. There is a big difference. The Backup file is 396KB and this file is only 28KB.
Please clarify.

the backup method described in this topic is copying the whole application data folder.
the application data folder contains all the separate business files and other database files.
so when restoring, you will have to identify the business data file from the backup folder and import it to Manager.

the normal backup procedure within Manager will only backup the current business data. this has to be imported to Manager as described in the guides.

I understand.
But in our case there is only one file at location C:\Users\Username\AppData\Local\Manager" named as “00000000000000000000000000000000.manager” whose size is 28 KB.
And the size of the downloaded and saved file with regular /standard Back up procedure is bigger, that is 396 KB.
That is why I am confused. Please guide.
Want to mention again that it is Server version of Manager running on Windows 10 Pro - 64bit OS. And we have only one business created.

The file you referenced is an index file. It contains no accounting data. 28KB is its default size and probably won’t change unless you open several businesses. For more understanding about data file names and storage schemes, read this Guide: https://guides.manager.io/8394.

This probably means you have set a different folder for your application data. If you are not the administrator, i would recommend you to contact the relevant person who installed the Manager server for you.

I installed Manager myself and I am logged in as Administrator.

I tried to Search " *.manager " files on my computer but could not find except “00000000000000000000000000000000.manager” on above location, it was only 28 KB and modified date was older, probably the day I installed Manager.

And there is no Folder location showed on Preferences page in Manager.

Have you imported the business backup file to Manager?

I just now created Backup with regular procedure to compare it with the file in Location C:\Users\Username\AppData\Local\Manager , did not try importing it.

Did you do the backup on a different computer?
Have you imported any business file on the computer you have installed the server edition? If no, first import it.

What folder path do you see on the DOS window when you run ManagerServer.exe ? That will be your application data path.

I am actually using nssm to auto start the Manager as a service.
Let me mention few things that I observed.
When I tried to run ManagerServer.exe directly (by double clicking it). My whole data disappeared, it was as if there is no data at all.
What I understand is, the data is stored somewhere else when we use nssm. Can you please help me to find where it could be, and how I can do Automatic Backups.

I would recommend running windows backup would be a fast solution