Hi Folks,
I'm very new to Exchange, so please excuse if there are obvious mistakes in my approach.
We are currently running Exchange 2010 in our Organisation and I need to create a Scheduled Task to run an Exchange query. I've tried following the article below to create the task, however I wanted to test the query from the Exchange Management Shell first to see if it works:
http://www.msexchange.org/kbase/ExchangeServerTips/ExchangeServer2013/Powershell/scheduling-exchange-powershell-task.html
The query is specified as part of an Argument in the Scheduled Task as below:
-version 2.0 -NonInteractive -WindowStyle Hidden -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; Set-MailboxJunkEmailConfiguration “feroz.khan” -TrustedSendersAndDomains @{Add="grey.black@def21.com"}"
Should I be able to run the above from the Exchange Management Shell? I ask because I am seeing the following error:
Missing expression after unary operator '-'.
At line:1 char:2
+ - <<<< version 2.0 -NonInteractive -WindowStyle Hidden -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExcha
nge.ps1'; Connect
-ExchangeServer -auto; Get-Mailbox -Server slkbrhmbx01 | Select DisplayName,RecipientLimit
s | Export-CSV C:\Output\MaximumRecipient
-Limits.cs
v -NoTypeInformation"
+ CategoryInfo : ParserError: (-:String) [], ParentContainsErrorRecordE
xception
+ FullyQualifiedErrorId : MissingExpressionAfterOper
ator
Our community of experts have been thoroughly vetted for their expertise and industry experience.