I would like to compile a list of local users accounts from all servers on the network. This would include domain and non domain W2K3 machines. A script to run net user and pipe the results to a file? Any help is appreciated. Thx
The Quick and Dirty Way
You'll need PsExec from Microsoft for this script to work. I'm assuming that you can connect to the non-domain member and domain member computers with the same username and password. If that's not possible, let me know and I'll change up the script a little bit.
Put a list of machine names into machines.txt and run:
You'll end up with a bunch of text files of the format computer-name.txt with the output of "NET USER" on each computer.
The Fancy(tm) Way
That's pretty quick-and-dirty and the output would be fairly painful to parse. Here's a fancier script in VBScript:
I've included some functionality to "ignore" groups or users, too.
Call this script redirecting input from a text file and output to a text file (i.e. "cscript script-name.vbs < machines.txt > report.txt") and you'll get a TAB delimited output of the format:
You might not need the group information but it'll be easy to filter away later.
If you need to connect to each machine with different credentials let me know and I'll change up the script a bit.
I remember working on something similar a few years ago. There is probably 5 ways that you could easily have this done via a script however recently I was introduced to SYDI and I recommend that you check it out, it might serve more benefits then just the audit tracking of users localy.
Snippit from site :Usage Scenarios You might want to track how many local administrators you have in your organization, perhaps some users have been placed in the local administrators group “temporarily” but have now settled in with all the privileges it provides. Even if your organization doesn’t yet disallow local administrative access you still might want to be able to see in black and white which users have been granted this access. The Power Users group can be another group you want to monitor.
If you have a standardized environment your group structure on your clients should all look the same way. You can use the tool to find any additional groups which shouldn’t be there.
Using the Script Like many other SYDI tools this script is written in vbscript and intended to be run from cscript.exe. To use it you provide an argument with the path to your SYDI Server output files:
Cscript.exe sydi-audit-localgroups.vbs -xN:\SYDI\Output
Let me know how it works out