8,330 questions
You can just add Proxy = <ProxyURLGoesHere>
to the $parameters hash.
The "not recognized" error usually just means the file "defender.ps1" wasn't found in the current directory.
Not sure about the "invalid token" problem without knowing where in the script the error occurs.