Cannot get Exchange PowerShell script to run under Scheduled Tasks

Solution 1:

First, let me tell you how you would run the script from a task:

Program/script: 
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Add arguments (optional): 
-PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'; &'Z:\Exchange Powershell\MailboxesApproachingOverQuota.ps1'"

Also note that, the user id you are using to run the script may need to be granted permissions on the local server.

update: Removed -noexit

Solution 2:

I'm guessing this script isn't signed. Have you enabled execution of unsigned scripts using the Set-ExecutionPolicy -ExecutionPolicy Unrestricted cmdlet?