'Thay C:\Temp\LocalAdminUser.txt thành tên group anh thích'Script này chỉ lấy thông tin Administrator trên máy tính localDim WshNetworkSet WshNetwork = CreateObject("WScript.Network")strComputer = WshNetwork.ComputerNameConst ForAppending = 8Set objFSO = CreateObject("Scripting.FileSystemObject")Set objLogFile = objFSO.OpenTextFile("c:\temp\LocalAdminUser.txt", _ForAppending, True)objLogFile.writeline " "objLogFile.writeline " **************** List of Users in Local Administors Group on " & strComputer & " ****************"Set colGroups = GetObject("WinNT://" & strComputer & "")colGroups.Filter = Array("group")For Each objGroup In colGroupsif (objGroup.Name ="Administrators") thenFor Each objUser in objGroup.MembersobjLogFile.writeline vbTab & objUser.NameNextEnd IfNextobjLogFile.Close'Open the List of user in Administrators groupSet WshShell = WScript.CreateObject("WScript.Shell")WshShell.Run "C:\temp\LocalAdminUser.txt"
==========================
'Thay C:\Temp\ServerList.txt thanh Folder và Server list bạn thich
' Trong Serverlist.txt anh add nhieu PCName or ServerName
'Thay C:\Temp\LocalAdminUser.txt thanh ten group anh thíich, ket qua se duoc export vao file này.
Const ForAppending = 8
Const ForReading = 1
ServerCount = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\temp\serverlist.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
strComputer = strNextLine
'WScript.Echo "Processing " & strComputer
ProcessGroups
ServerCount = ServerCount + 1
Loop
'WScript.Echo "Computers Processed " & ServerCount
'WScript.Quit
Sub ProcessGroups
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("c:\temp\LocalAdminUser.txt", _
ForAppending, True)
objLogFile.writeline " "
objLogFile.writeline "**************** " & strComputer & " ****************"
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
'Ki?m tra n?u là group Administrators thì ghi vào file.
For Each objGroup In colGroups
if (objGroup.Name ="Administrators") then
For Each objUser in objGroup.Members
objLogFile.writeline vbTab & objUser.Name
Next
End If
Next
objLogFile.Close
End Sub
' M? file LocalAdminUser.txt lên
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\temp\LocalAdminUser.txt"
download:https://mega.nz/#!zhg0gSqR!eghIWCscwHw7VNeUF5C_RoWqVv5XPMt4ObQvgKCcM5M
nguồn itlab.com.vn
0 comments:
Post a Comment