This article is for InventoryControl v7. For versions 4, 5, and 6, see Related Pages below.
(If your installation of v7 is an upgrade from v6, and the database is running on SQL Server 2005 Express, use the v6 version of the article linked below.)
Download and extract https://dl.waspbarcode.com/kb/ic/v7/BackupDB4ICv7.zip on the server, then run BackupDB4ICv7.bat to create a backup file in C:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.WASPDBEXPRESS\MSSQL\Backup\. The filename will be MIBackup_<date.stamp>.bkp.
If you need to change the path or filename, edit BackupDB4ICv7.wql with Notepad to change the line starting SET @FileName. If you are changing the file path, it must be directed to a local folder that already exists on the server, or the script will fail.
To schedule this process to run automatically, you can make use of the Windows Task Scheduler, as follows:
In Windows 7:
- Go to Start > All Programs > Accessories > System Tools > Task Scheduler.
- It may spend a few seconds adding a snap-in to the management console, then it will open.
- On the Actions pane at the right, select Create Basic Task.
- Provide a name for the task, like WaspBackup, then click Next.
- Chose how often you wish the process to run from the list, then click Next to enter the details. Depending on how often you selected, you will be prompted to enter the day of the week or month and the time to run the process.
- On the next page, it will ask what action you want it to perform. Click the radio button for "Start a program" and click Next, then Browse.
- Locate BackupDB4ICv7.bat, select it and click Open, then Next.
- If you check the box for "Open the Properties dialog for this task when I click Finish", it will open an interface with many additional conditions for the task. This is where you can specify a different user for the task to run as, as well as options for whether to run when the user is logged in only, or whether the user is logged in or not. It does default to only when the user is logged in. Also, on the Settings tab, there are boxes for "Run task as soon as possible after a scheduled start is missed" and "If the task fails, restart every:", which you should look at. This Properties window is the same as what opens if you initially choose Create Task rather than Create Basic Task, so you may start here, but the initial rule creation may be easier in Basic Task. To see the task, click Task Scheduler Library at the top left. Click on the task in the top center pane, and the Properties will be shown in the bottom center pane for verification. If you need to change any of the settings, you will need to right click the task and select Properties.
In Windows XP:
- Go to Start > All Programs > Accessories > System Tools > Scheduled Tasks.
- Double click Add Scheduled Task.
- Click Next on the welcome message, then Browse. Locate the BackupDB4ICv7.bat file and select it.
- Chose how often you wish the process to run from the list, then click Next to enter the details.
- Depending on how often you selected, you will be prompted to enter the day of the week or month and the time to run the process.
- You will then be prompted for the username and password of a Windows user, and the task will run as that user. You should enter a user who has sufficient rights in Windows to run the bat file and write into the specified directory.
- If you choose to open the advanced properties for the task, you will be able to specify several additional things, like whether to run the task when the computer is on battery power, etc. Usually the default settings will be fine. The task will now be shown in the Scheduled Tasks window, should you wish to check/change the properties or verify the status of when it will run, when it last run, and whether it failed when last attempted.
If the scheduled task does not run properly, here are some additional things to try:
1) Set the task to "configure for Windows7 or Windows 2008 R2" on the first page of the task properties (under the "general" tab)
2) Set the task to "start in" the folder that contains the batch file: open the task properties, click on the "actions" tab, click on the action and then the "edit" button at the bottom. In the "Edit Action" Window there is a field for "start in (optional)" that you set to the path to the batch file.
3) Make sure that the task is running as an account that has explicit "Full access" permissions to all these things: The .bat file itself, the folder containing the .bat file, and the target files/folders that are affected by the .bat script. Inherited permissions may not work, depending on your installation of Windows.
4) Make the account running the task a member of the local "administrators" group for this machine
5) If you want the task to be able to run after you have logged out of Windows, make sure that the task is set to "run whether logged on or not"
6) The Task should run successfully with expected output when you right-click on the task and select "run". If it does that, then it will run successfully when you are logged off.