For a while now I have been merely using Environment("UserName") to identify the person running a given script. This can be spoofed fairly easily and I'm looking for a more definitive means of getting the user name for the person running the script.
In messing around with this and doing some generic searches I found that calling the Kernel32.dll "GetCurrentProcessID" to get the current PID of the script then using the GetOwner method of Win32_Process appears to be a reliable means.
Just wondering if this is as reliable as it appears or if perhaps there might be a similarly reliable means with less code.
There are multiple ways to get the current user account name. Here is but one taken form the Tech Database:
AddExtender("wwwnt34I.dll")
user =wntGetUser(@default)
Message("I am",user)