Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Qustion on NT Service - Logged in user

Qustion on NT Service - Logged in user

Scheduled Pinned Locked Moved C#
questioncsharpwcfcomalgorithms
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    malharone
    wrote on last edited by
    #1

    I thought I'd get lucky with Google on this one, but unfortuantely didn't find anything. Or may be i was searching using the wrong keywords. (I'd put my bet on the latter) Preamble: I created a hello-world NT service in C# (nothing fancy here -- no WCF involved) and using installutil I'm able to deploy the service and then eventually using net start, I'm able to run the service as well. The service is running under "local system" account. The service has a timer, which ticks, say every 1 minute. Question: During the timer tick event handler, I'd like to find out a) if there is ANY user logged in at this time and b) if so, what is the name of the user who is using the machine? I'm not interested to know which account is being used to run the NT service. I tried System.Enviornment.UserName but that doesn't return what I need. It simply returns "user name of the person who started the current thread.". (http://msdn2.microsoft.com/en-us/library/system.environment.username.aspx[^]) I hope to find a trivial solution to a trivial problem. Thanks, - Malhar

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups