Link to home
Create AccountLog in
Avatar of bsharath
bsharathFlag for India

asked on

Get all the administrator users from all machines in the list

Hi,

I need to get who is the administrator of the machine.I need to get from all the machines from the list.
Machine name and Users who have administrator priviledges.

Regards
Sharath
Avatar of Alan Huseyin Kayahan
Alan Huseyin Kayahan
Flag of Sweden image

      Hi Sharath
                Now this script fits that question :)

                for /f %x in (c:\computers.txt) do psexec \\%x net localgroup administrators >> result.txt

Regards
Avatar of bsharath

ASKER

I have tried with many machines.I get this error.

C:\Pstool>for /f %x in (c:\computers.txt) do psexec \\%x net localgroup administ
rators >> result.txt

C:\Pstool>psexec \\Dev-chen-mrd100 net localgroup administrators  1>>result.txt


PsExec v1.63 - Execute processes remotely
Copyright (C) 2001-2005 Mark Russinovich
Sysinternals - www.sysinternals.com

Error communicating with PsExec service on Dev-chen-mrd100:
The pipe has been ended.

C:\Pstool>psexec \\Dev-chen-srv401 net localgroup administrators  1>>result.txt


PsExec v1.63 - Execute processes remotely
Copyright (C) 2001-2005 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec could not start net:
Logon failure: unknown user name or bad password.

C:\Pstool>psexec \\Dev-chen-srv400 net localgroup administrators  1>>result.txt


PsExec v1.63 - Execute processes remotely
Copyright (C) 2001-2005 Mark Russinovich
Sysinternals - www.sysinternals.com

Couldn't access Dev-chen-srv400:
The trust relationship between this workstation and the primary domain failed.
Any help....
I tryed this works but in the results file i am not able to know fo which machine the data  is.
ASKER CERTIFIED SOLUTION
Avatar of Alan Huseyin Kayahan
Alan Huseyin Kayahan
Flag of Sweden image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer