#149108 - 2005-10-03 05:34 PM
Local Administrator Account Audit for Servers
|
Mehmet
Fresh Scripter
Registered: 2005-08-12
Posts: 7
|
hi , I've number of Servers globally ( 80 ) All these are win2003 servers .And country responsibles are managing them individually .and I'm member of Admin Group of these Servers .
What I would like to achieve is to run Kix script on my Computer which will enable me to see Local Administrator Group of Each Server That I'll specifiy . Problem comes at that phase , I'm not sure if it can be happen with Kix or not ?
thanks
|
|
Top
|
|
|
|
#149109 - 2005-10-03 07:16 PM
Re: Local Administrator Account Audit for Servers
|
maciep
Korg Regular
   
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
Sure it can be done. Here's a little script to get the ball rolling for you...
Code:
'Server: ' gets $server $admins = getobject('WinNT://' + $server + '/Administrators') for each $member in $admins.Members ? $member.Name next
|
|
Top
|
|
|
|
#149110 - 2005-10-03 07:42 PM
Re: Local Administrator Account Audit for Servers
|
Mehmet
Fresh Scripter
Registered: 2005-08-12
Posts: 7
|
YES! ..  its totally worked .
Couple of questions if dont mind .
1-May script read server names from some text file 2-May script produce text file ( Administrator Account Groups ) for all the servers . 3-Last Would it possible script to write member of that groups into the Text file . like ;
Server : EZEX001 Admin Rights : Administrator World\World_Global_Admins ...............Jkusach ...............Csantana ...............Acamirez Europe\European_Support_Team ..............Hgeorge ..............Gbush etc. ?
Thanks for the prompt reply .
Respectfully , M
|
|
Top
|
|
|
|
#149112 - 2005-10-03 08:05 PM
Re: Local Administrator Account Audit for Servers
|
Mehmet
Fresh Scripter
Registered: 2005-08-12
Posts: 7
|
NTDOC,
Of course will do , I've just entered Kix World .And much intrested after see sample scripts .But for time being programming/scripting too far for me to acheive .Thats Why I asked you to the group .To do it myself will take days and days to understand ..But need to have it as quick as possible , thats also another reason why I looked that forum .
Thank you very much indeed .
Rgds
|
|
Top
|
|
|
|
#149113 - 2005-10-03 08:31 PM
Re: Local Administrator Account Audit for Servers
|
maciep
Korg Regular
   
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
How does this work for you?
Code:
break on $ = setoption('Explicit', 'On')
dim $inFile, $outFile, $curServer dim $admins,$member,$
; list of servers $inFile = 'c:\Servers.txt'
; results $outFile = 'c:\ServerAdmins.txt'
$ = open(1,$inFile) if exist($outFile) del $outFile endif $ = redirectoutput($outFile)
$curServer = trim(readline(1)) while @error = 0 ucase($curServer) ':' if cstr(wmiPing($curServer)) $admins = getobject('WinNT://' + $curServer + '/Administrators') if @error = 0 for each $member in $admins.Members ? $member.Name next else ? 'Error: ' @serror endif else ? 'Warning: Does not ping' endif ? ? $curServer = trim(readline(1))
loop
Function wmiPing($Address,Optional $Timeout,Optional $BlockSize) Dim $Query,$oWMI,$oItem,$cItems
$Query = "Select ResponseTime,StatusCode From Win32_PingStatus Where Address='" + $Address + "'" If $Timeout $Query = $Query + " And TimeOut=" + $Timeout EndIf If $BlockSize $Query = $Query + " And BufferSize=" + $BlockSize EndIf $oWMI = GetObject("winmgmts:root\cimv2") $cItems = $oWMI.ExecQuery($Query) For Each $oItem In $cItems If (VarTypeName($oItem.StatusCode) = 'Null') Or $oItem.StatusCode Exit 1 Else $wmiPing = $oItem.ResponseTime EndIf Next EndFunction
|
|
Top
|
|
|
|
#149116 - 2005-10-03 09:42 PM
Re: Local Administrator Account Audit for Servers
|
maciep
Korg Regular
   
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
Not too familiar with the properties available to that member class, but from what i can gather, this should work.
Code:
break on $ = setoption('Explicit', 'On')
dim $inFile, $outFile, $curServer dim $admins,$member,$adsPath,$
; list of servers $inFile = 'c:\Servers.txt'
; results $outFile = 'c:\ServerAdmins.txt'
$ = open(1,$inFile) if exist($outFile) del $outFile endif $ = redirectoutput($outFile)
$curServer = trim(readline(1)) while @error = 0 ucase($curServer) ':' if cstr(wmiPing($curServer)) $admins = getobject('WinNT://' + $curServer + '/Administrators') if @error = 0 for each $member in $admins.Members $adsPath = $member.adsPath $adsPath = split($adspath,'WinNT://')[1] if instr($adsPath, $curServer) $adsPath = substr($adsPath,instr($adsPath,'/') + 1) endif ? $adsPath next else ? 'Error: ' @serror endif else ? 'Warning: Does not ping' endif ? ? $curServer = trim(readline(1))
loop
Function wmiPing($Address,Optional $Timeout,Optional $BlockSize) Dim $Query,$oWMI,$oItem,$cItems
$Query = "Select ResponseTime,StatusCode From Win32_PingStatus Where Address='" + $Address + "'" If $Timeout $Query = $Query + " And TimeOut=" + $Timeout EndIf If $BlockSize $Query = $Query + " And BufferSize=" + $BlockSize EndIf $oWMI = GetObject("winmgmts:root\cimv2") $cItems = $oWMI.ExecQuery($Query) For Each $oItem In $cItems If (VarTypeName($oItem.StatusCode) = 'Null') Or $oItem.StatusCode Exit 1 Else $wmiPing = $oItem.ResponseTime EndIf Next EndFunction
|
|
Top
|
|
|
|
#149117 - 2005-10-03 09:46 PM
Re: Local Administrator Account Audit for Servers
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
Yep, that works
|
|
Top
|
|
|
|
#149118 - 2005-10-04 07:34 PM
Re: Local Administrator Account Audit for Servers
|
Mehmet
Fresh Scripter
Registered: 2005-08-12
Posts: 7
|
Thank you very much for all ,
This is splendid .It worked and saved a lot of time for me .
I've never seen such an helpfull , quick responded forum .
Thanks to who's maintaining this group and all others again .
Mehmet
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 568 anonymous users online.
|
|
|