Link to home
Start Free TrialLog in
Avatar of Twhite0909
Twhite0909

asked on

Run a Active Directory Admin query

In AD Powershell how can I pull a report to show me all ADMINs in AD and export to csv?

Thanks in advance.
Avatar of Rajitha Chimmani
Rajitha Chimmani
Flag of United States of America image

What kind of administrators are you looking at? And what is the version 2003 or 2008?
Avatar of Twhite0909
Twhite0909

ASKER

AD 2008 and I basically want to find any user account with any type of admin a cess besides local admin
Hi,

This will pull you the groups and members of administrator and child group or user if any...

get-adgroupmember -Identity administrators  -recursive

To export to csv

get-adgroupmember -Identity administrators  -recursive  | export-csv c:\temp\admin_members.csv

Open in new window


Regards,
Prem
It says completed successfully but in RED so looks like an error also it exported the file but it is 0KB.

Here is the syntax I got after the cmd ran

Get-ADGroupMember : The operation completed successfully
At line:1 char:18
+ get-adgroupmember <<<<  -Identity administrators  -recursive  | export-csv c:
\temp\admin_members.csv
    + CategoryInfo          : NotSpecified: (administrators:ADGroup) [Get-ADGr
   oupMember], ADException
    + FullyQualifiedErrorId : The operation completed successfully,Microsoft.A
   ctiveDirectory.Management.Commands.GetADGroupMember
That command should work for you.  Check the permissions of the user you're running under.
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've requested that this question be closed as follows:

Accepted answer: 500 points for Subsun's comment #a38855393
Assisted answer: 0 points for Twhite0909's comment #a38844276

for the following reason:

Answer was received from another source