Answer the question
In order to leave comments, you need to log in
Determining the current Windows user from under a service running as another user with minimal privileges?
Good afternoon.
I am writing a service on .Net Core.
It is assumed that the service will be started from a technological account with minimal rights (the maximum allowable minimum).
Task: Determine the active user of the system.
Using WMI, you can get the current user: wmic computersystem get username (SELECT UserName FROM Win32_ComputerSystem) The
trouble is that it is in the case when the service will be started from a technological account with minimal rights SELECT UserName FROM Win32_ComputerSystem returns an empty string. If you run the service as an administrator instead of a technological account, then everything works correctly.
Actually a question: how to receive the current user in my case?
I will listen to all suggestions and I will be very grateful.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question