Jump to content

Is it possible to enumerate logon scripts?


ceez

Recommended Posts

Hello fellow msfn'ers!

We currently have about 30 different logon scripts and i know for a fact that not all of them are being used. I want to clean them up from our sysvol\scripts folder and only leave the one's that are being used. Is there a way to enumerate all the accounts in AD and have it 'spit out' the logon scripts for the users? This way i can compare the list to the scripts that we have and delete the ones that are not used.

thanks for your help,

ceez

:thumbup

ps- actually had 65 scripts, cut it down to 50! So much easier now when having to edit scripts, i am not wasting time fixing 15 useless ones!

Edited by ceez
Link to comment
Share on other sites


On a domain controller, run:

CSVDE -F c:\logonscr.csv -R "(&(objectCategory=user)(scriptPath=*))" -L sAMAccountName,scriptPath

This will give you a comma-delimited text file which can be imported into something like Excel if you want to sort/filter easily. There will be 3 columns: the user's DN (distinguishedName in AD), the username (easier to read if you want to print a list), and the logon script. The file will look like this:

DN,sAMAccountName,scriptPath
"CN=Administrator,CN=Users,DC=yourdomain,DC=local",Administrator,adminlogon.bat
"CN=Joe Blow,OU=Sales,OU=Western Region,DC=yourdomain,DC=local",JBlow,saleslogon.bat
"CN=Jane Doe,OU=Accounting,OU=CorpHQ,DC=yourdomain,DC=local",JDoe,acctlogon.bat

Of course, all of this is based on the assumption that your logon scripts have been assigned the old NT way. If you have assigned any logon scripts via GPO, this will not find them. On the other hand, any which have been assigned via GPO would be quick & easy to find using the GPMC.

Edited by hosebeast
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...