+ Reply to Thread
Results 1 to 2 of 2

Thread: How to get Log-on user name from windows service?

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    29

    How to get Log-on user name from windows service?

    I am running a windows service as system account.

    I want to get some data of currently log on user.

    How can I do this on Windows Vista and Windows 7?

    Any idea would be appreciated.

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    26
    a. Get the currently session id using WTSGetActiveConsoleSessionId API
    b. Get the user name from WTSQuerySessionInformation with WTSUserName parameter.
    c. Free the user name via WTSFreeMemory.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts