Question : Need a script that will query all user accounts and groups in the Local Adminstrators group for WIndows 2000/2003 Servers

I need a script that will query all user accounts and groups in the Local Adminstrators group for WIndows 2000/2003 Servers.  Does anyone have a batch or a vbs script that will query all servers in a input txt file?

Answer : Need a script that will query all user accounts and groups in the Local Adminstrators group for WIndows 2000/2003 Servers

The below should do what you're after. Save it as a vbs file, and call from the command line via cscript, e.g.

cscript localadmins.vbs

It will connect to each server listed in the file C:\serverlist.txt, and tell you who's in the Administrators group. The txt file should just have each server name in a single list, no other text or it will fail.

It's pretty basic but you get the general gist...

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Set objFSO = CreateObject("Scripting.FilesystemObject")
Set objTxt = objFSO.OpenTextFile("C:\serverlist.txt",1)
 
While Not objTxt.AtEndOfStream
	strComputer = objTxt.ReadLine
	Set colGroups = GetObject("WinNT://" & strComputer & "")
	colGroups.Filter = Array("group")
	For Each objGroup In colGroups
	    If objGroup.Name = "Administrators" Then
	    	For Each objUser in objGroup.Members
	       	 	Wscript.Echo objUser.Name & " is a member of " & objGroup.Name & " on " & strComputer   	 	
	    	Next
	    End If  
	Next
Wend
Open in New Window Select All
Random Solutions  
 
programming4us programming4us