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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enumerating Users on Windows 2000

Status
Not open for further replies.

skispray

Programmer
Feb 28, 2003
16
US
I'm trying to run a script using WMI that will list the Local User Accounts on a machine that I specify. Microsoft provided the following example but said it the LocalAccount property doesn't work on Windows 2000. If the query is "where LocalAccount=True" then how do I query a Win2K machine?

Code:
On Error Resume Next
strComputer = "SERVER1"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_UserAccount Where LocalAccount = True")
For Each objItem in colItems
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Name: " & objItem.Name
Next

Thanks for the help!
 
Hello skispray,

The official documentation no longer mentions this. Telnet sample continues to list this note. I don't know why. (It happens.)

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top