Getting insufficient privileges error while running a script, based on entire message:
MgrMsg: SVR_NT TST.NT/ESP.23/MAIN State FAILED Cmpc(1314) SetEnd Status(Insufficient privileges) User(xxxxxx) Host(xx)
The user can run the script from command line, but the agent can't.
Workload Automation System Agent
The agent service should be run as local system account. Also, ensure that the agent has access to write to the agent spool files.