Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Script to get a list of SIDs in a NT 4.0 domain

Posted on 2004-10-01
Medium Priority
Last Modified: 2011-10-03
Hello, I would like to get a complete list of all users, groups (local and globals ) and computers in a domain NT 4.0
Do you know any script to do it ?

Question by:intentalo69
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 57

Expert Comment

by:Pete Long
ID: 12198439
Copy all AD users to a text file

From http://www.experts-exchange.com/Operating_Systems/Q_20698009.html#9073544

Being a scripting nut, I tend to approach these kind of problems from a scripting standpoint.

copy and paste the code below into "Mattisastud.vbs" and then run it.

Then open the GroupMembership.txt file and it should have everything you need.  
If you want to view the machine accounts also, uncomment the commmented line...

-=-=-=-=-=-=-=-=-=-=-=-=-=-  Code Below  -=-=-=-=-=-=-=-=-=-=-=-=-=-  

Dim myNetwork
Set myNetwork = CreateObject("Wscript.Network")

strDomain = myNetwork.UserDomain

Set objDomain = getobject("WinNT://" & strDomain) 'Grab the domain object
objDomain.filter = Array("Group") 'Filter for just computers.

Dim myFSO
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set myFile = myFSO.CreateTextFile("GroupMembership.txt",1)

myOutput = ""

For each objGroup in objDomain
    myOutput = myOutput & objGroup.Name & vbcrlf
   For Each objUser in objGroup.Members
'          myOutput = myOutput & vbtab & objUser.Name & vbcrlf
         If right(objUser.name,1) <> "$" Then
              myOutput = myOutput & vbtab & objUser.Name & vbcrlf
         End if

WScript.Echo myOutput
myfile.writeline myOutput

-=-=-=-=-=-=-=-=-=-=-=-=-=-  End Code  -=-=-=-=-=-=-=-=-=-=-=-=-=-  


*****Other Links*****

How can I create a file containing all the user names in my domain?

How can I produce a list of the user logon names in my domain?

Run a Group/User or User/Group report.

Expert Comment

ID: 12199694
here is another option
the csvde and ldifde utilities can export user information


Author Comment

ID: 12208504
Hello guys!
thanks for the answer. I've tried to run this script in the NT 4.0 PDC, but this script does not work
I get the error "runtime error:file name or class name not found during...... operation: 'getobject'
I think this script cannot work in NT 4.0, doesn't it?
Please remember, that I would like to obtain a list of users and groups of a NT 4.0 domain.

Author Comment

ID: 12219286
Ok my question is focus on the idea of getting a list of users (in plain text file) to be used as input
to other script that we have to get the SIDs.
I think it easy to create a list using Hyena or dameware and then use it as parameter list to the other script
Anyway I don`t know if there are any tool to generate a list of sid of all users and groups in a NT 4.0 domain (not in Actie directory)


Accepted Solution

LittleRed1 earned 1000 total points
ID: 12263963
Hi intentalo69

I'm not sure about the computers, but I'l try anyway

From the command line (or in a batch script) you need to do three things:

To get a list of users
for /f "skip=7 tokens=1-3" %a in ('net users /domain^|find /v "The command"') do echo %a>>users.txt&echo %b>>users.txt&echo %c>>users.txt
You don't need to  pipe it to file if you don't want to

To get a list of groups (must be done from a domain controller)
for /f "skip=5 tokens=1-3 delims=*" %a in ('net group^|find /v "The command"') do echo %a>>groups.txt&echo %b>>groups.txt&echo %c>>groups.txt

For a list of computers try this (there will be a '$' at the end of each computer name which can be removed if needed)
for /f "tokens=1-3" %a in ('net group "Domain Users"') do (echo %a&echo %b&echo %c)|find "$" >>computers.txt

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

719 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