I have some windows services written in C#. When somebody stops or starts the service, I would like to be able to determine who it was and log that information.
I tried logging Environment.UserName but that evaluates to SYSTEM even on my local machine.
Also, for the time being these services are running on Windows 2000 server.
Within the Event Viewer (Control Panel | Administrative Tools | Event Viewer) on the System tab the Service Control Manager logs who started and stop each event. I’ve just tested this myself and viewed the results. This leads me to two things:
Hope that leads you to your solution.