Could you confirm if you are using double quotes in the location of the script in the UI under desktop pool settings? If not, you might be hitting a known bug in horizon 7.11 and 7.12. Perhaps the script is not being called in secure way.
As of now to workaround it, you can call a wrapper script that calls the target script with the correct parameter. A wrapper script just needs to have the full path to the target script. Ideally it should be installed in Windows\Temp\VMware for security.
For additional details and permanent fix please submit a ticket with VMware support.