Link to home
Create AccountLog in
Avatar of alaayehya
alaayehya

asked on

Admin rights

I need to know if there is a utility to check remotely if users has local admin rights in domain
Avatar of Gavincr001
Gavincr001
Flag of United States of America image

you can use Psexec from Microsoft Sysinternals to remotely run this command against a list of machines.

You'll need to be loggon on with an admin account which can read all the computers you checking.

Psexec \\computername net localgroup "administrators"
or
Psexec \\computers.txt net localgroup "administrators"
Avatar of Krzysztof Pytko
Or download MBSA (Microsoft Baseline Security Analyzer) which allows you local administrators group checking and also evaluates other security risks. It's free Microsoft tool, you can download it from

http://technet.microsoft.com/en-us/security/cc184924

Regards,
Krzysztof
Avatar of alaayehya
alaayehya

ASKER

how to work with psexec because i install ps tools but i didnot know how to run it or use it?should we write a script or what?

what I need is to check for example 20 pcs to know which domain username has local admin on the pc logging to.

thanks
how to work with psexec because i install ps tools but i didnot know how to run it or use it?should we write a script or what?

what I need is to check for example 20 pcs to know which domain username has local admin rights on the pc logging to.

for example:
username :alaay(domain user)
pc name :pc210
does alaa have local admin rights on pc210?
that what I want to know on all the pcs

thanks
Gavincr001 provided an example.

In your case the format will be:

psexec \\pc210 net localgroup "Administrators"

There are vbscrips that do the same using WMI or directly querying the remote computer.
The scripts are a good starting point
https://www.experts-exchange.com/questions/24754216/Query-Members-of-local-Administrators-Group.html
http://www.visualbasicscript.com/Listing-local-group-users-with-WMI-m2048.aspx
http://stackoverflow.com/questions/21514/enumerate-windows-user-group-members-on-remote-system-using-c
thanks arnold but I need to know where can I run psexec.
where should I put it.I am not expert in scripting would you please give me a script for doing that and tell me where should I apply it.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Hi alaayehya,

Do you have a domain admin acocunt you can use:

On your own PC or server try the following:

- Create a folder called c:\localadmin
- open psexec.exe to this folder
- open a command promot then type cd c:\localadmin
- type the following and use a domain admin account for user and password, or any account which is local admin on all  your PC's
- Psexec -u domain\username -p password \\pc201 net localgroup "administrators"

you can also create a text file with all the PC names and save the file to c:\localadmin then type the following:
- Psexec -u domain\username -p password \\computers.txt net localgroup "administrators"
make sure your command promt is in this folder  c:\localadmin

Let us know how it went.


part of the question is answered