I've created a second powershell script that contains a number of lines like above to create separate .csv files for each of our shared services members. The script also emails the appropriate .csv to each client.
.\Get-MailboxReport.ps1 -customAttribute1 hcca -filename hcca.csv
If I run the .bat file interactively from the Exchange Management Shell it executes perfectly. When it is run from the task scheduler the script runs but does not seem to execute the parameters after the Get-MailboxReport.ps1 on any of the lines.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\Scripts\Exchange2010\Get-MailboxReport\GenAllReportsAndMail.ps1"
From novice to tech pro — start learning today.