Hi,
i created a simple script named test.ps1, with the following content:
Search-Mailbox -Identity "Mailboxname1" -SearchQuery "Subject:'Something'" -DeleteContent -Force
Search-Mailbox -Identity "Mailboxname2" -SearchQuery "Subject:'Something'" -DeleteContent -Force
Search-Mailbox -Identity "Mailboxname3" -SearchQuery "Subject:'Something'" -DeleteContent -Force
Taskscheduler/ Program/Script
Taskscheduler / Arguments
-NonInteractive -WindowStyle Hidden -command ". 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\Program Files\Microsoft\Exchange Server\V15\Scripts\test.ps1
But it will not work, sadly i dont realy know where to look at for an error message. if i run the simple script directly from the EMS it will work perfectly....