Hello,
today my scheduled Exchange-Shell Script isn`t working anymore.
I am having a scheduled job that starts the program "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
In add argument i am having the following :
-command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; e:\Scripts\logfile_import_request.ps1"
When doing this manually
1) start PS --> no problem
2) start script remoteExchange.ps1 --> no problem, output :
Welcome to the Exchange Management Shell!
Full list of cmdlets: Get-Command
Only Exchange cmdlets: Get-ExCommand
Cmdlets that match a specific string: Help *<string>*
Get general help: Help
Get help for a cmdlet: Help <cmdlet name> or <cmdlet name> -?
Show quick reference guide: QuickRef
Exchange team blog: Get-ExBlog
Show full output for a command: <command> | Format-List
Tip of the day #46:
Want to add an alias to multiple distribution groups that have a similar name? Type:
$Groups = Get-DistributionGroup *Exchange*
$Groups | Add-DistributionGroupMember -Member kim
This command adds the alias kim to all distribution groups that contain the word Exchange.
3) when starting the logfile_import_request.ps1 :
the script is :
$file = $(Get-Date -Format 'dd_MM_yyyy HH_mm tt') + ".txt"
Get-MailboxImportRequest | Get-MailboxImportRequestStatistics -IncludeReport | Format-List | Out-File "\\192.168.2.21\$file" -width 120
When running "get-mailboximport-request" manually from EMS there is no problem and the command is recognized.
What is going wrong and why?
Thx