-
Jan 13th, 2022, 08:28 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Retrieve current Windows user when application is run as other user
If an application is executed as a user other than the current Windows user, how can the current Windows user be retrieved? Environment.Username returns the "run as" user and not the current Windows user.
-
Jan 14th, 2022, 03:53 AM
#2
Thread Starter
Frenzied Member
Re: Retrieve current Windows user when application is run as other user
I resolved this using a very tidy library called Cassia:
https://code.google.com/archive/p/cassia/
Code:
Imports Cassia
Dim t As New TerminalServicesManager
Dim sCurrentWindowsUsername As String = t.CurrentSession.UserAccount.ToString
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|