Jump to content

Differentiate if running as local admin vs domain admin?


Recommended Posts

Thanks - yeah I've used the AD UDF here and there. Was kind of hoping there was a easier quicker way since the AD UDF query is a tad slow. And then I'm assuming one would have to loop through the array _AD_GetUserGroups returns looking for an appropriate OU admin group. Was kind of hoping there would be some more basic way within windows to determine this, but if the domain admin account is only granted local rights, how else would one divine this without querying AD?

So rats, unless anyone else has some other trick up their sleeve.

 

 

Link to post
Share on other sites
38 minutes ago, DrLarch said:

So rats, unless anyone else has some other trick up their sleeve.

You should be able to get the information by running the WHOAMI console command with the appropriate switch(es).

Link to post
Share on other sites

Thanks Xman, WHOAMI works great! And no AD query required...

Edit: Oops, well WHOAMI would have to be used in combination with some kind of AD lookup it seems. WHOAMI just let's you know if it's a local or domain user. And regarding _AD_IsMemberOf, one would need to know the name of the domain admin group, since domain design varies. At least in the domain I work in, there really aren't any global admin accounts for security, only OU/Specific Site Admin accounts.

So it still appears there's no universal way to determine if the user is a domain admin or just a user with local admin rights.

Edited by DrLarch
Link to post
Share on other sites

Would be neat if there was some kind of IsAdmin() function that could return values like:
0 - Not Admin
1 - Local Admin
2 - Domain Admin

But not sure that's even possible...

Edited by DrLarch
Link to post
Share on other sites

Domain Admin doesn't necessarily grant different permissions than being a local admin.  For most cases, the Domain Admin group is added to devices when they are joined to a domain, but in environments with stricter security requirements, this may not be the case.  I just wanted to point out that Domain Admin membership may not be a universal. 

Having said that, you would know your environment best and if you are sure that the domain admin group is in fact a member of local Administrator groups of all domain joined Windows computers, then enumerating if an account is a member of the Domain Admins group and/or checking the Local Administrators group (or executing permissions if elevated) is your best recourse.

Link to post
Share on other sites

Will check when I return to my computer if the AD UDF can help. 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

According to this article using

net localgroup "Administrators"

will return a list of local admin users.
If you select all AD groups (starting with <domain\> or just by looking for a backslash) and query the members you should get a list all all users with full access to the computer.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Graeme
      I have a new Windows 8 computer and it won't compile scripts in my non admin account but it will in the admin account which is fine except that I want to use the non admin account.
      I have a simple script
      MsgBox(0,"Test","This is running") and this is the output I get when I try to compile it.
      >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "C:UsersGraeme_2DocumentsTestNon.au3"
      +>10:58:14 Starting AutoIt3Wrapper v.2.2.0.3 SciTE v.3.4.1.0   Keyboard:00000809  OS:WIN_81/  CPU:X64 OS:X64    Environment(Language:0809)
      +>         SciTEDir => C:Program Files (x86)AutoIt3SciTE   UserDir => C:Program Files (x86)AutoIt3SciTEAutoIt3Wrapper
      -> No changes made..
      >Running AU3Check (1.54.22.0)  from:C:Program Files (x86)AutoIt3  input:C:UsersGraeme_2DocumentsTestNon.au3
      +>10:58:21 AU3Check ended.rc:0
      >Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\Aut2Exe\aut2exe.exe  /in "C:UsersGraeme_2DocumentsTestNon.au3" /out "C:UsersGraeme_2AppDataLocalAutoIt v3Aut2exe~AU3yjbyxti.exe" /nopack /comp 2
      !>10:58:21 Aut2exe.exe ended errors because the target exe wasn't created, abandon build. (C:UsersGraeme_2AppDataLocalAutoIt v3Aut2exe~AU3yjbyxti.exe)rc:9999
      +>10:58:21 AutoIt3Wrapper Finished.
      >Exit code: 0    Time: 7.94
       
      Any ideas about how I can compile programs in this account welcome.
      Blessings
×
×
  • Create New...