Solved

AD users report in xls

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
schema master 5 27
How to remove users in file list from specific AD group? 3 40
Locating a GPO setting 3 31
Migrate GPO Forest to Forest 4 16
[b]Ok so now I will show you how to add a user name to the description at login. [/b] First connect to your DC (Domain Controller / Active Directory Server) SET PERMISSIONS FOR SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME 1. Open Active …
Synchronize a new Active Directory domain with an existing Office 365 tenant
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 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