In regards to
upsShell.exe CustomScriptEx=AppName~UserID~PW~DOMAIN~LoadBalancerName~LogDirectory~ScriptName

Is there any way of passing arguments to the script identified at ~ScriptName
I've tried a few alternatives but can't seem to get my script going with arguments, works fine when its just a subprocedure without args.