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

Extract to spreadsheet users and login scripts

Hi,

We have inhertited an NT4 network with 250 users and im trying to find out which login script each users uses without having to manually open their account up and look.  Do you know of a utility that will export each user to perhaps a .csv file with the associated login script they are using.

This would save me loads of time

Many thanks in advance

Daz
0
dazzler1971
Asked:
dazzler1971
  • 2
1 Solution
 
Rich RumbleSecurity SamuraiCommented:
NET USERS /DOMAIN >USERS.TXT  will get you a list of users... not much else... (replace DOMAIN with your Domain name)
NET ACCOUNTS /DOMAIN >ACCOUNTS.TXT
NET CONFIG SERVER >SERVER.TXT

There are some preconfigured wmi scripts that may help you, but an easy way to get the files to CSV format is to use WMIC.exe available on xp and 2003.
http://www.microsoft.com/technet/scriptcenter/scripts/ds/local/users/default.mspx
http://www.microsoft.com/technet/scriptcenter/scripts/ds/local/users/lousvb08.mspx <---

Set objDomain = GetObject("WinNT://fabrikam,domain")              **note replace fabrikam,domain with your username and domain**
objDomain.Filter = Array("User")

For Each objUser In objDomain
    Wscript.Echo objUser.Name
Next

I don't see an easy wmic script to do this right now, I'll try to work on it- but I also don't see these methods returning the the logon script value either...
-rich
0
 
Rich RumbleSecurity SamuraiCommented:
Found it...

Set objDomain = GetObject("WinNT://fabrikam,domain")              **note replace fabrikam,domain with your username and domain**
objDomain.Filter = Array("User")
For Each objUser In objDomain
       WScript.Echo "Name, " & objUser.Name & " ,"
        WScript.Echo "Fullname, " & objUser.Fullname & " ,"
        WScript.Echo "Description, " & objUser.Description & " ,"
        WScript.Echo "AccountDisabled, " & objUser.AccountDisabled & " ,"
        WScript.Echo "IsAccountLocked, " & objUser.IsAccountLocked & " ,"
        WScript.Echo "Profile, " & objUser.Profile & " ,"
        WScript.Echo "LoginScript, " & objUser.LoginScript & " ,"
        WScript.Echo "HomeDirectory, " & objUser.HomeDirectory & " ,"
Next

I added Comma's after the descriptions and after each entry that will be returned so in effect it's a csv format. Copy the above into a text file, save it, rename the txt extension to vbs and your all set. I tested this and it works very well!

You may also try the same with this: http://www.activexperts.com/activmonitor/windowsmanagement/adsi/samples/

Sub ListUsers( strDomain )
    Set objComputer = GetObject("WinNT://" & strDomain )
    objComputer.Filter = Array( "User" )
    For Each objUser In objComputer
        WScript.Echo "Name, " & objUser.Name & " ,"
        WScript.Echo "Fullname, " & objUser.Fullname & " ,"
        WScript.Echo "Description, " & objUser.Description & " ,"
        WScript.Echo "AccountDisabled, " & objUser.AccountDisabled & " ,"
        WScript.Echo "IsAccountLocked, " & objUser.IsAccountLocked & " ,"
        WScript.Echo "Profile, " & objUser.Profile & " ,"
        WScript.Echo "LoginScript, " & objUser.LoginScript & " ,"
        WScript.Echo "HomeDirectory, " & objUser.HomeDirectory & " ,"
        WScript.Echo " ,"      
    Next
End Sub
Dim strDomain
Do
    strDomain = inputbox( "Please enter a domainname", "Input" )
Loop until strDomain <> ""
ListUsers( strDomain )

It will prompt you to enter your domain!
-rich

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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