Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Export AD usernames and login scripts used

Posted on 2007-11-16
2
Medium Priority
?
1,886 Views
Last Modified: 2012-06-27
Greetings!

I'm not sure if this is even possible but here goes.

I'm wanting to export ALL user names from our AD and the login script each user uses.  I'm trying to organize and determine which scripts are being utilized and which need to be deleted.  This is a 2003 sever environment.  If I can provide any additional information please let me know!
0
Comment
Question by:WVCA
[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 48

Expert Comment

by:Jay_Jay70
ID: 20298137
the DSTools should show you what you need.....i used it to similarly display profiles

http://www.robvanderwoude.com/adshelp/adshelp.html
0
 
LVL 7

Accepted Solution

by:
carcenea earned 2000 total points
ID: 20298793
Here is the code a a VBscript that will do what you want. All you should have to is change "dc=domain,dc=com" to "dc=yourdomain,dc=com". It will export all user's info into a textfile - userinfo.txt. There are a few extra fields as I've used this in the past for my own means.

Hope this helps!

Oh, and if you're not familiar with vbscript just put this code in a textfile and save the textfile with a .vbs for the extension.
' ListUsersOU.vbs
' Pulls specific info from each user in the domain and puts the info in a txtfile
' Author Chris 
' Created 10/31/2007
 
'Global variables
    Dim oContainer
    Dim OutPutFile
    Dim FileSystem
    Dim MyDate
'Set Date so that txt file can be unique
MyDate = Date()
MyDate = Replace(MyDate, "/", "-")
'Initialize global variables
    Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
    Set OutPutFile = FileSystem.CreateTextFile("UserInfo" & MyDate & ".txt", True)
    Set oContainer = GetObject("LDAP://dc=domain,dc=com")
oContainer.Filter = Array("organizationalUnit")
strList = ""
'Enumerate Container
    EnumerateUsers oContainer
'Clean up
    OutPutFile.Close
    Set FileSystem = Nothing
    Set oContainer = Nothing
    Set MyDate = Nothing
    'The line below is for testing purposes only.
    'WScript.Echo "Finished"
    WScript.Quit(0)
Sub EnumerateUsers(oCont)
    Dim oUser
    For Each oUser In oCont
        On Error Resume Next
        Select Case LCase(oUser.Class)
               Case "user"
                    If Not IsEmpty(oUser.distinguishedName) Then
                       OutPutFile.WriteLine "DisplayName: " & oUser.displayName
                       OutPutFile.WriteLine "Logon Name: " & oUser.sAMAccountName
                       OutPutFile.WriteLine "Phone Number: " & oUser.telephoneNumber
                       OutPutFile.WriteLine "Office: " & oUser.physicalDeliveryOfficeName
                       OutPutFile.WriteLine "Description: " & oUser.description
                       OutPutFile.WriteLine "Login Script: " & oUser.scriptPath
                       OutPutFile.WriteLine
                    End If
               Case "organizationalunit", "container"
               EnumerateUsers oUser
        End Select
    Next
End Sub

Open in new window

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
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 video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

604 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