Try to build a GUI for some mailbox administration stuff.....
The command below produces syntax errors.
Get-Mailbox $dlist.alias -Resultsize Unlimited | Search-Mailbox -SearchQuery "Received:`$DateFromvar..`$DateTovar Subject:$Sub" -DeleteContent -Force >\\Server\Share\file.txt
Error: Please adjust the date time. Make sure it is in the correct format.
When I output $DateFromvar and $DateTovar is appears to be correct. Running the command natively in PowerShell runs successful as well.
What am I missing?
Thanks
Djoe