Solved

enhance batch files

Posted on 2012-04-10
5
335 Views
Last Modified: 2012-05-08
Dear persons,

Looking to add enhancements to a specific client-run batch file.  The batch file drives a special backup solution, and mobile workers are required to perform a manual backup with some regularity.  The job consists of a third-party backup solution but is activated by a batch file.

I am hoping to add features into the batch file, eitehr via scriptig or possibly via  a third-party (affordable for sure) that will include such enhancements as:  Emailing when the job completes successfully; logging how many times the batch is run, and perhaps a couple of more features.
0
Comment
Question by:SRC-S1
5 Comments
 
LVL 53

Expert Comment

by:Bill Prew
ID: 37830892
For emailing from a BAT file check out BLAT, it's a common free tool that can provide that capability.

http://www.blat.net/

For other enhancements if you can share more specifics, and/or your current script we can then provide some detailed solutions.

~bp
0
 
LVL 7

Expert Comment

by:mayureshtodankar
ID: 37830924
Please share the script, so we enchance it more with logging and emailing options.
0
 
LVL 1

Author Comment

by:SRC-S1
ID: 37831075
My script file is as follows:

echo off
cls
c:\BUSpec\BUSPec.exe c: \\main-server\Workstations\%computername%-%date%.BUS
cls
exit


Basically this script loads the DOS-based backup utility and runs it, saving the backup job into the server's workstations backup folder, and including the computer name and date in the file name.

For some sites, we run this through the built-in Windows Task Scheduler, and it will run accoridng to that schedule.  For manual deployments it is up to the user.

Either way, there is no way to track when it runs, neitehr whether the job was successful or not.  I can only gues that there are likely some third-party, and free or low-cost, solutions that will work together with windows-based batch files top include enhancemenbts such as emailing (though Blat may work as provided by BillPrew) and hopefully a logging or flagging of when and how many times the manual batch is run.
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 37832548
Determining success would get difficult. You can't just check for existence of the BUS file, as the backup might be partially successful - having not backed up some important data.
Logging when a backup is (tried to) run is no issue; just create a log file and write date and time into it. If you put it onto the server, you have easy access, but any issue in regard of not being able to access the server would stay unnoted. So maybe a two-step logging is a good idea:
@echo off
echo off
cls
>> c:\BUSPec\%computername%.log 2>&1 (
  @echo ---- %date% %time% -------
  c:\BUSpec\BUSPec.exe c: \\main-server\Workstations\%computername%-%date%.BUS
)
copy \\main-server\Workstations\BUS-%computername%.log+c:\BUSPec\%computername%.log >nul 2>nul && del c:\BUSPec\%computername%.log
exit /b

Open in new window

That way you should be able to spot generic errors. I don't know whether BUSPec.exe will output any useful information, but if, it is logged.
The script can then take the output, search for some keywords like "SUCCESS", and determine whether it has been ok or not. But to help further we would need to see example logs for success and failure.
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 37845453
@SRC-S1

Is there any documentation for the BUSpec backup utility you are using that you could point me to online?  I'd like to see what capabilities it has for error returns and logging.

~bp
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question