Logon Scripts - Active Directory 2000

Posted on 2004-11-22
Last Modified: 2012-05-05
I want to amalgamate our logon scripts. I have recently started a new job and it seems that the logon scripts need cleaning up.

At present there are 42 different batch files on the netlogon share. Is there a quick way of finding out what logon script every user is using for the whole domain??

Any help will be appreciated


Question by:nickymo
    LVL 70

    Expert Comment

    by:Chris Dent

    Ouch, that's a lot of scripts...

    Not having much luck with this so far, but just in case it helps at all...

    The attribute you need to read from Active Directory is scriptPath, you can create a custom LDAP query in AD Users and Computers which will report specific script names as follows:

    1. Right click on Saved Queries folder and select New / Query
    2. Select Define Query
    3. Change Find field to Custom Search
    4. Select Advanced as type: scriptPath=<script name>

    If you use a * instead of the script name it will show you all of them, but since it doesn't allow you to add scriptPath to the columns that's not really much use.

    Of course creating 42 seperate queries is far from ideal, and hardly quick, but it's just really a matter of producing a better form of output. I'll attempt to get a script working that'll do it and post again.

    LVL 70

    Accepted Solution


    I don't suppose all your users are in the same OU are they?
    LVL 1

    Author Comment

    42 queries is good enough for me!!
    LVL 70

    Expert Comment

    by:Chris Dent

    Fair enough :)

    Just in case you did only have one OU you can query all the users and have it dump everything to a file (Semi-Colon delimited so it can be imported into Excel).

    Problem is, it only does a specific OU, I haven't figured out how to make it drill down through all OUs.

    ' LogonScriptPath.vbs
    ' Description:
    ' Lists Logon Script path for all users in the specified Organisational Unit.

    Option Explicit

    ' Constant Declaration

    Const OUTPUT = "Out.txt"

    ' Variable Declaration

    Dim objRootDSE, objUsers, objUser, objFileSystem, objOutput
    Dim strScriptPath, strName

    ' Object Initialization

    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    Set objRootDSE = GetObject("LDAP://rootDSE")

    ' This defines the start location

    Set objUsers = GetObject("LDAP://<Organisational Unit>," &


    set objOutput = objFileSystem.OpenTextFile(OUTPUT,8,TRUE)

    For Each objUser In objUsers

          strName = objUser.Get("name")
          strScriptPath = objUser.scriptPath

          objOutput.writeline(strName & ";" & strScriptPath)

    LVL 70

    Expert Comment

    by:Chris Dent

    Set objUsers = GetObject("LDAP://<Organisational Unit>," &


    Should be

    Set objUsers = GetObject("LDAP://<Organisational Unit>," & objRootDSE.Get("defaultNamingContext"))

    That is, on one line.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Sometimes you might need to configure routing based not only on destination IP address, but also on a combination of destination IP address (or hostname) and destination port number. I will describe a method how to accomplish this with free tools. …
    This is the first one of a series of articles I’ll be writing to address technical issues that are always referred to as network problems. The network boundaries have changed, therefore having an understanding of how each piece in the network  puzzl…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    754 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

    26 Experts available now in Live!

    Get 1:1 Help Now