I've knocked up a vbScript based on one we use to poke user reg-keys into the HKCU of logged on users when executing a package as SYSTEM. Among a couple of methods I've used to get the logged users, this is quite simple and robust. It is a sample and you'll need to edit it to fit your requirement. I'm happy to help you do that if you need it after you've had a look.
The script will return 0 (zero = success) if there is no-one logged on or if no qualifying user is logged on.
It will return the exit code of the called installation command if it gets that far.
It will return the error code of any catastrophic script error, and log the error in the local application event log.
Let me know if this is any way close to what you need - remove "_.txt" from the attachment name to use.
When calling the script use:
Testing: just double-click it.
Executing from CMS:
WScript.exe //B "path\to\script.vbs"
The //B (batch mode) means that on error it will not display an error in the background, but it will exit and still return the error code and log to the local Application event-log.
Regards Darren.