Hi all

Long time KiXtart user, first time poster. I'm writing a script that lists people using MYOB (an accounting package for those unaware, and yes it does stand for that) because their data file has gotten to the point where it crashes regularly, locking out users and requiring a manual flush of the lock files before they can get in. To make matters worse, sometimes some goose leaves MYOB open and goes to lunch, leaving everyone else in the lurch.

To resolve this problem, I'm writing a script to allow the users to handle this process themselves (as an ASE executable running as an administrator user to give them the access they need without giving them full administrator rights) - not (just) because we're lazy, but because sometimes it happens outside our office hours and if it happens to someone on the west coast (we're east) after 5pm local time, they're stuck until tomorrow. It sort of came to a head when it happened to someone in Perth while they were processing pays...

To this end, I have the following code to look for anyone using that particular data file:

 Code:
Dim $sUser, $sDomain
	
$sFileName = "SNR Dodgy Constructions Pty Ltd.MYO"

$oWmi = GetObject("winmgmts://./root/cimv2")
	
$oEnum = $oWmi.ExecQuery("SELECT * From Win32_Process WHERE CommandLine LIKE '%%$sFileName%%'")

For Each $oInst in $oEnum
	$ = $oInst.getOwner($sUser, $sDomain)
	? "User: " $sUser
Next


Which works great, except it doesn't get the owner. Since KiX doesn't support passing by reference, what (if any) other options do I have for getting this information?

EDIT: KiXtart 4.64, running Windows Server 2008 R2


Edited by efarayenkay (2015-05-29 04:32 AM)