首页 文章

powershell exchange:你如何设置一个计划任务来运行exchange2007 powershell?

提问于
浏览
0

我在操作选项卡下设置计划任务(现在称为任务计划程序)以在Windows 2007服务器上运行时遇到问题 . 它还有Exchange Server 2007 .

我试过设定

程序/脚本:C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe添加参数(可选): - psconsolefile exshell.psc1 -command“&{c:\ mes-detail \ emsbilling08.ps1}”从(可选):“C:\ Program Files \ Microsoft \ Exchange Server \ Bin \

我意识到exshell.psc1可能还需要一个显式路径,所以我也尝试过:

-psconsolefile C:\ Program Files \ Microsoft \ Exchange Server \ Bin \ exshell.psc1 -command“&{c:\ mes-detail \ mailall3.ps1}”“但这也不起作用

有任何想法吗?

3 回答

  • 1

    我想我会在这里分享决议来完成开始 .

    1)在.ps1文件中为计划任务添加Add-PSSnapin exchange 2),执行以下操作:程序/脚本:C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe添加参数(可选): - noprofile - 非交互式c:\ mes-detail \ emsbilling08.ps1从(可选)开始:“C:\ Program Files \ Microsoft \ Exchange Server \ Bin \

    如果仍然不起作用,请运行以下检查:

    开始...运行C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe -noprofile Get-PSSnapin -Registered您是否看到Microsoft.Exchange.Management.PowerShell.Admin Microsoft.Exchange.Management.Powershell.Support如果是这样,请添加-pssnapin交换

  • 0

    什么不起作用?您是否尝试手动运行其中一个命令,看看会发生什么?

    (顺便说一句:建议,你可能想把它带到minasi.com/forum或powershelcommunity.org上的PowerShell论坛 . 你可能会要求更多的读者了解这个话题,因为这是StackOverflow程序员的有点边缘 - 中心人口) .

  • 0

    PS C:\ Windows \ System32 \ WindowsPowerShell \ v1.0> add-pssnapin exchange Add-PSSnapin:机器上未安装Windows PowerShell管理单元交换 . 在行:1 char:13 add-pssnapin <<<< exchange

    在脚本中写入完整名称:

    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Support
    

相关问题