Solved

email result of scheduled task

Posted on 2014-03-25
7
802 Views
Last Modified: 2014-03-29
Hi  all  I've created a task to run repadmin.exe /replsummary. is it possible to email the the result.  Thanks
0
Comment
Question by:cwstad2
  • 3
  • 3
7 Comments
 
LVL 18

Accepted Solution

by:
Raheman M. Abdul earned 250 total points
ID: 39952970
Try this:

$replsummary = invoke-expression { cmd.exe /c repadmin.exe /replsummary }
$Body = $replsummary

$to = "receivername@domain.com"
$from = "sendername@domain.com"
 Send-MailMessage -SmtpServer mail.domain.com -From $from  -To $to -Subject 'repl Summary' -Body $body
0
 
LVL 13

Assisted Solution

by:Santosh Gupta
Santosh Gupta earned 250 total points
ID: 39953682
Hi,

if you are using windows 2008 or 2012 then you can achieve this goal by using the "Task Scheduler".
sch
1. create a task to run "repadmin.exe /replsummary > C:\reports\Replication_report.txt".
2. create another task to send the email with using "Replication_report.txt" file as attachment.
 
Note: every time the task 1 will run it will over write the Replication_report.txt file. After that 2nd task will send it for you.

Hope it will help you.
0
 
LVL 15

Author Comment

by:cwstad2
ID: 39953796
hi I can't get the code to work it just opens up the text file
0
Are your end users making ugly email signatures?

Have you left it up to your end users to create their own email signatures? Are they forgetting to add the company logo or using garish font colors? Take control and ensure all users have the same email signature.

 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 39953874
Hi,

you mean "repadmin.exe /replsummary > C:\reports\Replication_report.txt" ??
0
 
LVL 15

Author Comment

by:cwstad2
ID: 39953941
That was on the powershell.  but I have tried the scheduled task and no output

thanks
0
 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 39953962
Hi,

do you have the C:\reports, seems not, then change the output path of file.
 or just use

repadmin.exe /replsummary > Replication_report.txt

create a batch file with above command. once success, put that into scheduler as task one.
0
 
LVL 15

Author Comment

by:cwstad2
ID: 39954531
Hi yes i have created the reports folder on C:\ will try the batch tomorrow
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

863 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

25 Experts available now in Live!

Get 1:1 Help Now