• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1354
  • Last Modified:

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

:@

0
nickymo
Asked:
nickymo
  • 4
1 Solution
 
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
 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now