how do I check if an account has logon as a service privileges
I am writing a pre-installation pre-requisite checker utility. I need to test the user account to see if it is local admin and if it has logon-as-a-service privileges. I was able to check for local admin easily using the code listed below. I am finding it very very difficult to check if it has logon-as-a-service privileges. Please help, I am really stuck!
code to check for local admin:
Code:
bool isAdmin;
WindowsIdentity user = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(user);
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
Re: how do I check if an account has logon as a service privileges
Re: how do I check if an account has logon as a service privileges