Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

How can I run an exchange management shell command within a scheduled task?

$
0
0

Hi,

I am trying to create a Windows Server 2008 R2 scheduled task that launches the exchange management shell application then runs a command. Within the "Action" of the scheduled task I am starting the below program:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

With the arguments:

-version 2.0 -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto" -Command "get-mailcontact -OrganizationalUnit "ABC.local/SP2013 Email Lists" -resultsize:unlimited -filter {ExchangeVersion -eq "0.0 (6.5.6500.0)"}  | Set-MailContact -EmailAddressPolicyEnabled:$true -RequireSenderAuthenticationEnabled:$False -Force"

But when the task runs I keep getting the below warning:

Task Scheduler did not launch task "\Microsoft\Windows\SharePoint\Upgrade Exchange Contact"  because instance "{42ef037d-e021-4ace-8a2c-84161175709e}"  of the same task is already running.

Followed by the below error:

Task Scheduler failed to start "\Microsoft\Windows\SharePoint\Upgrade Exchange Contact" task for user "ABC\Administrator". Additional Data: Error Value: 2147750687.

Any thoughts?

Thanks.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>