I want to run this using task scheduler
Get-MailboxStatistics -Server mailserver | Select DisplayName, ItemCount, TotalItemSize | Sort-Object TotalItemSize -Descending | Export-CSV "\\pacetoputreport\report_$((Get-Date).ToString('MM-dd-yyyy')).csv"
I know I have to run some variation of this to launch the exchange module
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto"
How can I do this in Task Scheduler? I have tried numerous times using various combinations, but nothing seems to work.
Thank you