?
Solved

AD users report in xls

Posted on 2013-10-29
2
Medium Priority
?
193 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 1000 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 1000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

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