Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

email result of scheduled task

Posted on 2014-03-25
7
Medium Priority
?
860 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
Raheman M. Abdul earned 1000 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 1000 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
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
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…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

636 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