Results 1 to 2 of 2

Thread: [RESOLVED] Retrieve current Windows user when application is run as other user

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,373

    Resolved [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.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,373

    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
  •  



Click Here to Expand Forum to Full Width