Solved

AD users report in xls

Posted on 2013-10-29
2
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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 …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

697 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