Merhaba
Server 2008 r2 üzerinden user'ların hangilerinde makinları üzerinde local admin grubuna üye olduğunu ve bu listeyi nasıl öğrenebiliriz.
Merhaba,
Bu script i deneyebilir misiniz?
' ************************************************** ************************************************** ***
' * *
' * Script name: ListLocalAdmin1.0.vbs *
' * Description: Lists all members of local administrators group of computers located in list *
' * *
' * Author: Konráğ Hall *
' * *
' * Platforms/Req: Windows 2000 or newer *
' * *
' ************************************************** ************************************************** ***
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objNetwork = CreateObject("Wscript.Network")
strLogFolder = "c:\Logs"
strInputfile = "C:\Logs\Comp.txt"
strLogfile = "c:\Logs\listlocaladmin"&date()&".log"
strComputer = objNetwork.ComputerName
Const ForReading = 1
On Error Resume Next
If ReportFileStatus(strInputfile)="False" Then
Wscript.Echo "Input file not found"
WScript.Quit
End If
If ReportFolderStatus(strLogFolder) = False Then
objFSO.CreateFolder(strLogFolder)
End If
If ReportFileStatus(strLogfile)="False" Then
Set logs = objFso.CreateTextFile(strLogfile)
logs.close
End If
Set objTextFile = objFSO.OpenTextFile (strInputFile, ForReading)
i = 0
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
If Not Left(strNextLine, 1) = "#" Then
objDictionary.Add i, strNextLine
i = i + 1
End If
Loop
For Each objItem in objDictionary
StrComputerName = objDictionary.Item(objItem)
If DeadOrAlive(StrComputerName) = "True" Then
Set objGroup = GetObject("WinNT://" & StrComputerName & "/Administrators,group")
For Each objUser in objGroup.Members
members = members & ";" & objUser.Name
Next
Set logs = objFso.OpenTextFile(strLogfile, 8)
logs.writeline(" "& now() & ";"& "Alive;" & StrComputerName & members)
logs.close
members = " "
Else
Set logs = objFso.OpenTextFile(strLogfile, 8)
logs.writeline(" "& now() & ";"& "Dead;" & strComputerName)
logs.close
End If
Next
'*****************************
'*** Check if log file exists
'*****************************
Function ReportFileStatus(filespec)
Dim fso, msg
Set objfso = CreateObject("Scripting.FileSystemObject")
If (objfso.FileExists(filespec)) Then
ReportFileStatus = True
Exit Function
Else
ReportFileStatus = False
Exit Function
End If
End Function
'*****************************
'*** Check if computer is alive
'*****************************
Function DeadOrAlive(ComputerName)
Set objShell = CreateObject("Wscript.Shell")
Set objScriptExec = objShell.Exec("ping -n 2 -w 1000 " & ComputerName)
If InStr(objScriptExec.StdOut.ReadAll, "Reply") > 0 Then
DeadOrAlive = True
Else
DeadOrAlive = False
End If
End Function
'Function wich returns either true or False
Function ReportFolderStatus(folderspec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(folderspec)) Then
ReportFolderStatus = True
Exit Function
Else
ReportFolderStatus = False
Exit Function
End If
End Function
Emre Aydın
MVP | Office 365 | Since 2006
MCT | Since 2005
MCSD | Azure Solutions Architect
MCSE | Private Cloud, Messaging, Communication, Server Infrastructure, Productivity, Platform
MCSA | Office 365, Server 2012, Cloud Platform
MCTS | Developing Azure Solutions, Implementing Azure Infrastructure, Architecting Microsoft Azure Solutions, SAM
P-Seller
Intelligent Cloud | EMS
Web : www.mshowto.org
Mail : emre.aydin [@] mshowto.org
Twitter : https://twitter.com/emreaydn
Linkedin : tr.linkedin.com/in/emreaydn