I am writing a vbscript component monitor which needs to run an external exe as a specific local user on the Orion server. So far I've found that although my credential for monitoring is set as that specific local user, my script, in fact, runs as the machine account instead. To test further I put together the following script to explicitly report the userids in use.
For the record, the machine name is copernicus, and the local user is copernicus\musr_mqadmin. The component credential is set to this userid. The test code is as follows and is executed passing ${USER} as the one and only argument.
Set lstArgs = WScript.Arguments
orion = trim(lstargs(0))
Wscript.Echo "Message.Orion:says I am " & orion
Wscript.Echo "Statistic.Orion:0"
set wshShell = createobject("wscript.shell")
Set wshEnv = wshShell.Environment("PROCESS")
Wscript.Echo "Message.Environment:says I am " & wshEnv("USERNAME")
Wscript.Echo "Statistic.Environment:0"
When I test run this script I get the following output...
Output Result: