Solved

AD users report in xls

Posted on 2013-10-29
2
177 Views
Last Modified: 2013-11-14
is there anyway to get an extract from your AD for all users, including username, status (i.e. open or disabled), password expires (yes/no), and groups memebership (ideally on the same row i.e. group1; group2; group3).... into excel/text document...
0
Comment
Question by:pma111
2 Comments
 
LVL 8

Assisted Solution

by:5teveo
5teveo earned 250 total points
ID: 39608739
Enter your Domain pattern in for SSSS,KKKK,FF,UU and a file will be created that can be imported into Excel. You may need to locate Attribute names you want special from AD. This sample has name, and path

Save this script as .VBS and run and file will be created with output.

 

'Read S4-Users and write out objMember.sAMAccountName & objMember.ADsPath
'
'MAke S4_USers_B_<DateTime> Backup
'
'Delete all S4-Users
'
Dim tsDate
Dim tsTime

tsDate = Year(Now) & "-" & Month(Now) & "-" & Day(Now) & Hour(Now) & "-" & Minute(Now) & "-" & Second(Now)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile_ADBackup = objFSO.CreateTextFile("S4-Users-" & tsDate & ".txt", 2)
Set objShell = WScript.CreateObject("WScript.Shell")


Dim objGroup
Dim objMember

'=========================================================================================
'Backup S4_Users Group before refreshing...
'=========================================================================================
'
'SSSS.KKKK.FF.UU/STUDENT/SCHOOLS/SPECIAL/BAC-9001/*Security Groups/S4_Users
'
Set objGroup = GetObject("LDAP://cn=S4_Users,ou=*Security Groups,ou=BAC-9001,ou=SPECIAL,ou=SCHOOLS,ou=STUDENT,dc=SSSS,dc=KKKK,dc=FF,dc=UU")
For Each objMember in objGroup.Members
    objFile_ADBackup.WriteLine objMember.sAMAccountName & "*" & objMember.ADsPath
Next

objFile_ADBackup.Close
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 250 total points
ID: 39610346
This is pretty strightforward with Powershell and much easier to accomplish. See below...

Get-ADUser -Filter * -Properties * | Select Name, Enabled, PasswordExpired, MemberOf | Export-Csv "c:\AllUsers.csv"

Will.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
Resolve DNS query failed errors for Exchange
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now