CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2012
    Posts
    3

    Unhappy 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);
    Last edited by mzachen; April 11th, 2012 at 11:18 AM.

  2. #2
    Join Date
    Apr 2012
    Posts
    3

    Re: how do I check if an account has logon as a service privileges

    .net 4.0

  3. #3
    Join Date
    Apr 2012
    Posts
    3

    Re: how do I check if an account has logon as a service privileges

    Heeelllllpppp

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured