The script looks good. I test the same script on one of my VM through a CMD and it installed an agent. It's a good idea to try the same to ensure the basic script works before adding complexity of SCCM. (Support has not used SCCM to deploy the agent)
Try to use the script in a CMD prompt on one of the machines.
- You will need the STPlatformUpdater.exe for this test, make sure it's in the same folder you are running the script from.
- Sometimes the Agent UI will install but the agent isn't completely installed, make sure you see the Policy: PolicyName in the very lower left corner of the Agent UI. You should also verify you can see the Patch Tasks under the Patch tab to ensure the full agent is installed.
If that fails, double-click on the STPlatformUpdater.exe and run through the install by hand. Make sure to use the same information from you script.
Lastly, spaces in the Policy Name may cause some funkiness.