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 / C++ / MFC
  4. Regarding Admin rights user

Regarding Admin rights user

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 2 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.
  • H Offline
    H Offline
    H4u32
    wrote on last edited by
    #1

    I am making Win32 application. My need is to determine whether current user has administrative rights or not. Also i need to check how many account exist on system with administrative rights. If no any account exist then create one with administrative rights. Any help would be greatly appreciated. Thanks hemang

    R 1 Reply Last reply
    0
    • H H4u32

      I am making Win32 application. My need is to determine whether current user has administrative rights or not. Also i need to check how many account exist on system with administrative rights. If no any account exist then create one with administrative rights. Any help would be greatly appreciated. Thanks hemang

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      Hemang Raval wrote:

      My need is to determine whether current user has administrative rights or not.

      BOOL IsUserAnAdmin()[^]

      Hemang Raval wrote:

      If no any account exist then create one with administrative rights.

      Windows will have at least one administrative account.

      Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

      H 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        Hemang Raval wrote:

        My need is to determine whether current user has administrative rights or not.

        BOOL IsUserAnAdmin()[^]

        Hemang Raval wrote:

        If no any account exist then create one with administrative rights.

        Windows will have at least one administrative account.

        Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

        H Offline
        H Offline
        H4u32
        wrote on last edited by
        #3

        Thanks for reply. Now How would i know about the number of accounts with administrative rights. I want to create another if there exist only one admin account. BTW, thanks for previous reply. i hope for positive reply for this question also Regards, Hemang

        R 1 Reply Last reply
        0
        • H H4u32

          Thanks for reply. Now How would i know about the number of accounts with administrative rights. I want to create another if there exist only one admin account. BTW, thanks for previous reply. i hope for positive reply for this question also Regards, Hemang

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          Look at NetUserEnum()[^] and NetUserGetInfo()[^].

          Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

          H 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            Look at NetUserEnum()[^] and NetUserGetInfo()[^].

            Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

            H Offline
            H Offline
            H4u32
            wrote on last edited by
            #5

            Thanks a lot again. I tried to use NetUserEnum. But it gives me the information about every account created on a machine. My requirement is to get only number of accounts and its information which are having administrator rights. Thanks in advance. Please help me out. Thanks Hemang

            R 1 Reply Last reply
            0
            • H H4u32

              Thanks a lot again. I tried to use NetUserEnum. But it gives me the information about every account created on a machine. My requirement is to get only number of accounts and its information which are having administrator rights. Thanks in advance. Please help me out. Thanks Hemang

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #6

              Hemang Raval wrote:

              My requirement is to get only number of accounts and its information which are having administrator rights.

              #1) There is nothing like GetNumberOfAccounts(). However, it should be easy to count the number of accounts yourself with the information NetUserEnum() provides. #2) For finding if an account has administrative rights, you can use NetUserGetInfo(), which I suggested in my previous post itself.

              Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

              H 1 Reply Last reply
              0
              • R Rajesh R Subramanian

                Hemang Raval wrote:

                My requirement is to get only number of accounts and its information which are having administrator rights.

                #1) There is nothing like GetNumberOfAccounts(). However, it should be easy to count the number of accounts yourself with the information NetUserEnum() provides. #2) For finding if an account has administrative rights, you can use NetUserGetInfo(), which I suggested in my previous post itself.

                Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                H Offline
                H Offline
                H4u32
                wrote on last edited by
                #7

                A bunch of thanks. I got a clue from your answer and also found solution for getting number of admin account from NetGetUserInfo. Thanks a lot again. Regards, Hemang

                R 1 Reply Last reply
                0
                • H H4u32

                  A bunch of thanks. I got a clue from your answer and also found solution for getting number of admin account from NetGetUserInfo. Thanks a lot again. Regards, Hemang

                  R Offline
                  R Offline
                  Rajesh R Subramanian
                  wrote on last edited by
                  #8

                  Hemang Raval wrote:

                  Thanks a lot again.

                  Glad to be of service. :)

                  Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                  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