The script worked for me but I found I had to have the values exactly right - otherwise I would get a generic failure. In particular, I had a typo in the computer name and the app GUID had a "/1" at the end (I suppose I was pulling the value from a table that had some kind of extended version of the app ID).
As to your other question, see the discussion about "AutoInstall" above. When you use approvals as per scenario 2, the question of whether the software should be installed automatically or not is defined at the point the approval is created (by the PowerShell script in this case), not when the deployment is created (in the ConfigMgr console). That's what the AutoInstall property is for.