如何在计划任务中运行Exchange管理shell命令? [英] How can I run an exchange management shell command within a scheduled task?
问题描述
我正在尝试创建Windows Server 2008 R2计划任务,启动Exchange管理外壳应用程序然后运行命令。在"行动"中计划任务我正在启动以下程序:
C:\ Windows \ system32 \ WindowsPowerShell \v1.0 \\\\\\\\\\\\\\\\ b
使用参数:
-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电子邮件列表" -resultsize:unlimited
-filter {ExchangeVersion -eq" 0.0(6.5.6500.0)"} | Set-MailContact -EmailAddressPolicyEnabled:$ true -RequireSenderAuthenticationEnabled:$ False -Force"
但是当任务运行时,我会收到以下警告:
任务计划程序未启动任务"\ Microsoft /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\因为实例"{42ef037d-e021-4ace-8a2c-84161175709e}" 相同的任务已经在运行。
后面跟着以下错误:
任务计划程序无法启动"\ Microsoft \ Windows \ \\ SharePoint \升级交流联系人"用户"ABC \Administrator"的任务。其他数据:错误值:2147750687。
有任何想法吗?
谢谢。
将此信息放入程序/脚本字段并将参数留空:
C:\ Windows \ System32 \ WindowsPowerShell\v1.0\powershell.exe -command"。 'C:\Program Files\Microsoft\Exchange Server\V14 \bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; get-mailcontact -OrganizationalUnit" ABC.local / SP2013电子邮件列表" -resultsize:unlimited
-filter {ExchangeVersion -eq" 0.0(6.5.6500.0)"} | Set-MailContact -EmailAddressPolicyEnabled:
true -RequireSenderAuthenticationEnabled:
False -Force"
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.
Put this into program/script field and leave arguments empty:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ". ‘C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1′; Connect-ExchangeServer -auto; 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″
这篇关于如何在计划任务中运行Exchange管理shell命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!