Logon Scripts - Active Directory 2000

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

:@

LVL 1
nickymoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris DentPowerShell DeveloperCommented:

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.

Cheers,
Chris
0
Chris DentPowerShell DeveloperCommented:

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nickymoAuthor Commented:
42 queries is good enough for me!!
0
Chris DentPowerShell DeveloperCommented:

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>," & 

objRootDSE.Get("defaultNamingContext"))

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

For Each objUser In objUsers

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

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

objOutput.close
0
Chris DentPowerShell DeveloperCommented:

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

objRootDSE.Get("defaultNamingContext"))

Should be

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

That is, on one line.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.