Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine user name and domain for current process
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
How to determine user name and domain for current process
Miscellaneous
Thread ID:
01017127
Message ID:
01017127
Views:
61
I found GetUserName api call should work for getting the user name. However, determining the current user's domain seems more problematic. I found the following approaches:
1. The environment variable UserDomain.
2. wscript.network com object, username & userdomain properties.
3. Get the SID for the current PID and call LookupAccountSID - this seems like the most reliable, but I'm not sure how to get from Application.ProcessID to SID through to LookupAccountSID.

In my test w/ a vfp com object running under COM+ services, UserDomain environment variable and the wscript.network object do not return the domain of the account that the com object is running under.

I've googled & searched UT, but haven't found all the pieces. I would appreciate if you have any insight and can point me in the right direction.

Best,
Mark Nadig
/\/\/
Next
Reply
Map
View

Click here to load this message in the networking platform