1

I'm trying to get a list of domain admin users from my Windows Server 2003 domain controller. I am unable to obtain it with powershell because the ActiveDirectory module is not installed.

I need to obtain it from CMD.

I have tried net group /domain "Domain Admins" and while this returns all the Domain Admin users I need the following format which I don't know how to obtain. Any ideas?

The list should contain:

User name (Baker, John for example)
sAMAccountName (`I can obtain this with net /group`)
Account creation date
Last logon date
If the account is enabled or not

EDIT: I have tried dsquery group -name "Domain Admins" | dsget group -members -expand but I don't get the expected output either.

DSKyo
  • 153
  • 3
  • 6
  • 15

3 Answers3

1

Try this:

dsget group <group DN> -members -expand > Group_Members.txt

The created document now contains the DN of each member of the group. You can then use this to get more details for each user

dsget user <user DN>
knurmia
  • 11
  • 3
Ben Lavender
  • 284
  • 1
  • 5
  • I have tried `dsget group "Domain Admins" -members -expand` but got the following error: `dsget failed:Value for 'Target object for this command' has incorrect format.`. Am I not using it right? – DSKyo Aug 31 '16 at 09:52
  • 2
    You need to use the DistinguishedName attribute. – Ben Lavender Aug 31 '16 at 15:20
  • Thanks, this worked, however I only got the domain admin user names and the OU they belong to, any idea how I can get the rest of the details i need? Account creation, when was the account created, and whether it is enabled or not? – DSKyo Sep 01 '16 at 12:20
0
Get-ADGroupMember "Domain Admins" | select name, objectclass, samaccountname >>C:\Users\[username]\Desktop\domainadmin.txt

Run in ad powershell

2003 not sure whether AD power shell can be imported or not .

Daniele Santi
  • 2,529
  • 1
  • 25
  • 22
safvan
  • 1
-2
$ADGroup = Read-Host "Please enter the AD Group Name to Query"
$ExportPath = Read-Host "Please Enter Fully Qualified Path to Export Query Resluts"
$LogonTime = Get-ADGroup "$ADGroup" | Get-ADGroupMember | Get-ADUser -Properties * | select bla, bla, bla.....
$LogonTime | Export-Csv "$ExportPath\$ADGroup-LogOnInfo.csv"
Sven
  • 98,649
  • 14
  • 180
  • 226
froyo
  • 1