Solved

Scheduled Blat (mail) task does not run Windows2012

Posted on 2014-03-12
7
3,726 Views
Last Modified: 2014-03-15
I have a  problem getting a scheduled task running Blat on a Windows Server 2012.

The task consists just one simple bat file with one line:

"D:\Program Files\OmniBack\bin\omnirpt" -report list_sessions -timeframe 24 24 | C:\windows\system32\blat -subject "Data Protector rapport" -to X.X@xxx.nl

The scheduling runs without any errors but no mail is send out, when running the bat file from a prompt (manual) it works fine.

I split the "problem" in two by running the command until the piping in the bat file scheduled, no problem.

When testing the bat file with only the mail command it fails to send the message out.

C:\windows\system32\blat -subject "Data Protector rapport" -to X.X@xxx.nl

While no errors appeared in logs or anywhere else I captured the output in a file by editting the line:

C:\windows\system32\blat -subject "Data Protector rapport" -to X.X@xxx.nl >> c:\scripts\output.txt

The output file now says:

Blat v3.1.1 (build : Feb 27 2013 20:04:23)
32-bit Windows, Full, Unicode

Failed to open registry key for Blat
To set the SMTP server's name/address and your username/email address for that
server machine do:
blat -install  server_name  your_email_address
or use '-server <server_name>' and '-f <your_email_address>'
aborting, nothing sent


I tried it with the /c command option in the scheduler al so.

The task is run by a domain account ,the same account is used when manualy running the batch file from a command prompt (as different user)

What goes wrong here?
0
Comment
Question by:Oldiesel
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 53

Expert Comment

by:McKnife
ID: 39923400
Hi.

Known "problem". The registry key that is mentioned is created when you first start blat. In your task, you will for sure use another account. So you will have to start blat in your command line from the same account as the task is running with!
0
 
LVL 83

Expert Comment

by:oBdA
ID: 39923417
Just do what the error message tells you to do: add '-server <server_name>' and '-f <your_email_address>' to your blat command line.
"D:\Program Files\OmniBack\bin\omnirpt" -report list_sessions -timeframe 24 24 | C:\windows\system32\blat -server your.smtp.server -f your@email.address -subject "Data Protector rapport" -to X.X@xxx.nl

Open in new window

0
 
LVL 3

Expert Comment

by:telczj9
ID: 39923433
The problem is that very first time you run it need to register with blat what will be the target mail server or SMTP server.  You also need to provide the email address that has been granted access to the mail server/SMTP server.  By default SMTP will allow any account with domain it uses.

Use syntax suggested by the output you capture.

blat -install  server_name  your_email_address

Open in new window


Cheers!
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

Author Comment

by:Oldiesel
ID: 39923631
Nope did not fall for that:-)

Offcourse blat has been registered, would be too easy:-)

Taken from the reg:

Windows Registry Editor Version 5.00

[HKEY_USERS\S-1-5-21-4071868041-848849937-436062856-1126\Software\Classes\
VirtualStore\MACHINE\SOFTWARE\Wow6432Node\Public Domain\Blat]
"SMTP server"="mailclustersmtp.netxxx.xxxx"
"SMTP Port"="25"
"Try"="1"
"Login"=""
"Pwd"=""
"Sender"="dataprotector@xxx.xx"


The problem does reside somewhere in the scheduling phase for sure.
When running the bat file manualy from the prompt it works fine!
0
 
LVL 53

Expert Comment

by:McKnife
ID: 39923636
You have not answered anything with that req-quotation. We don't know if S-1-5-21-4071868041-848849937-436062856-1126 is the user that you configured in the task.
0
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 39923651
Please add the -server and -f options to the command line and try again. Running as a scheduled task is not the same as an interactive session.
0
 

Author Closing Comment

by:Oldiesel
ID: 39931965
Behavior of a bat or cmd script is sure different when scheduled.
When adding the -server and -f option in the commandline in the bat file it worked, when running it in a dos box it worked fine without the (extra) parameters.

The error was setting me on the wrong path, it had nothing to do with register or installing Blat as the error suggested.
1

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now