Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract Local Users from Windows Server 2000

Status
Not open for further replies.

wlfpackr

IS-IT--Management
May 3, 2003
161
0
0
US
I need to extract local users off of some Windows Server 2000 boxes for audit purposes. I can get VBscript to work on Server 2003 and 2008 without issues, but not so lucky with a solution for 2000. Anyone have any suggestions?

=================
There are 10 kinds of people in this world, those that understand binary and those that do not.
 
>I can get VBscript to work on Server 2003 and 2008 without issues...
Why don't you mention which approach you've got it works on them? There isn't a unique approach if you think the contrary to warrant a non-mention.

For instance, you can use wmi to get to them.
[tt]
scomputer="."
set svc=getobject("winmgmts://" & scomputer & "/root/cimv2")
squery="select * from win32_useraccount where localaccount=true"
set cusers=svc.execquery(squery)
for each ouser in cusers
wscript.echo ouser.name 'and other properties, read documentation
next
set cusers=nothing
set svc=nothing
[/tt]
Since you did not mention which way to start with, maybe you should not ask for other approaches in order not to abuse the forum's time?
 
Your script is essentially the same as mine and doesn't work on any of the Windows 2000 Servers either.

Just a note, please stick with actual answers and lose the lecture speech, especially since it didn't offer up a solution.

=================
There are 10 kinds of people in this world, those that understand binary and those that do not.
 
You should be ashame of your unprofessional question and answer.
 
And you say you join tek-tips since 2003.
 
After searching off and on for a couple of days, I finally found the answer. In Windows 2000 and earlier, sounds like the Win32_UserAccount doesn't have the property 'LocalAccount' so you have to take a different approach in the query.
Code:
"Select * from Win32_UserAccount Where Domain = '" & strServerName & "'"
Note: strServerName would be the variable holding your computer name.

This approach worked for me for W2k, W2k3, W2k8 and supposedly works on NT4.




=================
There are 10 kinds of people in this world, those that understand binary and those that do not.
 
thanks for pointing that out wlfpackr.
if you hadnt have said 'Note: strServerName would be the variable holding your computer name' i really would have been lost.

in my 'now' infinite wisdom i rarely post questions on this forum, however when i do i have a policy of awarding a star to anyone who is kind enough to respond, i dont care if they 'really' gave me the solution or not. I find your responses a little rude.


I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top