The Findid utility lets you easily find user IDs. To retrieve a specific ID, run the utility and type any part of the user's full name in uppercase, lowercase, or mixed-case letters. If you leave the input box blank, Findid returns a list of all user IDs.
The If...Then...Else statement at callout B in Listing 2 retrieves all user IDs when you leave the input box blank. This statement sets a print flag to 1 if an ID exists, the input box is blank, and the ID doesn't contain a dollar sign ($—i.e., the ID isn't a computer account).
I use Tab logic to format the output. You might want to use commas instead (e.g., if you want to import a full domain listing into Microsoft Excel), but tabs make for better readability when you're looking up an individual user or a few users with similar names. If you want your output to include a count of the IDs that Findid has returned, you can uncomment the txtfile.WriteLine line at callout C that contains the count variable and comment out the subsequent line. If you make this change, you might need to adjust the Tab logic.
Findid has no error checking. Before you run it, you need to either rename the Tempfile file or make sure that you don't have a file with that name. The only other thing you need to do is change Workgroup at callout A to the name of your domain. To use this utility, you also need to have Active Directory Service Interfaces (ADSI) on a Windows NT 4.0 machine.