2008-12-04 31 views
0

我在操作選項卡下設置計劃任務(現稱爲任務計劃程序)以在Windows 2007服務器上運行時遇到問題。它還具有Exchange Server 2007的powershell exchange:你如何設置一個計劃任務來運行exchange2007 powershell?

我試過設置

程序/腳本:C:\ WINDOWS \ SYSTEM32 \ WindowsPowerShell \ V1.0 \ powershell.exe 添加參數(可選):-psconsolefile exshell .psc1 -command 「& {C:\ MES細節\ emsbilling08.ps1}」 出發點(可選):「C:\ Program Files文件\微軟\ Exchange服務器\ BIN \

我意識到exshell.psc1可能還需要一個明確的路徑,所以我也試過了:

-psconsolefile C:\ Program Files \ Mi crosoft \ Exchange Server \ Bin \ exshell.psc1 -command「& {c:\ mes-detail \ mailall3.ps1}」,但這也行不通

任何想法?

回答

0

什麼不行?你有沒有試過手動運行這些命令之一,看看會發生什麼?

(順便說一句:建議,你可能想把它帶到minasi.com/forum或powershelcommunity.org的PowerShell論壇。你可能會問更多的知道這個話題的聽衆,因爲這有點兒StackOverflow的以程序員爲中心的人羣的邊界線)。

+0

酷..感謝您指出我在這個方向 – phill 2008-12-04 17:33:33

1

我想我會分享這裏的決議來完成開始。

1)在你的.ps1文件中把附加PSSnapin 交換

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

獲取-PSSnapin - 註冊

你看到 Microsoft.Exchange.Management.PowerShell.Admin Microsoft.Exchange.Management.Powershell.Support

如果是這樣,附加pssnapin 交換

0

PS C:\ WINDOWS \ SYSTEM32 \ WindowsPowerShell \ V1.0>附加pssnapin交換 添加-PSSnapin:Windows PowerShell管理單元,以換取不安裝在馬赫 內。 在行:1個字符:13 + 附加pssnapin < < < <交換

寫腳本的全名:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin 
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Support 
相關問題