'Created By Ram B C www.askmewindows.in
'Created Date : 10/24/2009
'This script is find the local Administrators and output in a Tab delimited File
'============================
'FAQ : Create two Files Listofcomputers.txt and AdminList.txt in C: Drive ( Provided you have Write Permission in C:)
' Give the computer names from which you need to find the Local Admin group
' Result will be present in the file C:\AdminList.txt
'==========================================
On Error Resume Next
Const ForAppending = 8
Set objFSO1 = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO1.OpenTextFile _
("c:\AdminList.txt", ForAppending, True)
strInputPath = "C:\ListofComputers.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objInput = objFSO.OpenTextFile(strInputPath,1,False)
Do Until objInput.AtEndOfStream
strComputer = Trim(objInput.ReadLine)
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
For Each objMember in objGroup.Members
MsgBox objMember.Name
objTextFile.WriteLine(strComputer & vbTab & objMember.Name)
Next
Loop
MsgBox "Done"
No comments:
Post a Comment