I am getting really frustrated to run two PowerShell Exchange scripts via Task Scheduler.
ort >> http://www.stevieg.org/2011/06/exchange-environment-report/
Test-ExchangeServerHealth >> http://exchangeserverpro.com/health-check-exchange-2010-mailbox-server/
Windows 2008 R2
I have two environments:
Lab Environment: Both work via Task Scheduler and when I run manually.
Production Environment: Only if I run the scripts manually. Not via Task Scheduler.
The user I am using on my production environment is a member of Domain Admins + Organization Management.
If I log in the production environment I can run my scripts manually successfully.
How my Task is configured:
Run whether user is logged or not - checked
Run with high privileges - checked
Argument: -c "push c:\scripts; c:\scripts\Get-ExchangeEnvironmentReport.ps1 -HTMLReport c:\scripts\report.html -SendMail:$true -MailFrom:email@example.com -Mailto:firstname.lastname@example.org -MailServer:smtp.domain.com
No matter what I do, the task seems to complete(according the history of the task - no erros whatsoever) but it does not send the report.
Initially I thought was my SMTP server, but if I run the script manually works
.\Get-ExchangeEnvironmentReport.ps1 -HTMLReport c:\scripts\report.html -SendMail:$true -MailFrom:email@example.com -Mailto:firstname.lastname@example.org -MailServer:smtp.domain.com
I already ran:
It is not a problem with the script. If I run manually it works. The same happens with the other script (Test-ExchangeServerHealth
). If I run mannually it works. If I try to run via Task Scheduler, nothing happens.
I reckon it is a permission issue. But to be honest I am running out of ideas.