Solved

AD users report in xls

Posted on 2013-10-29
2
175 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

Join & Write a Comment

Know what services you can and cannot, should and should not combine on your server.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

762 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

18 Experts available now in Live!

Get 1:1 Help Now