Page 1 of 1 1
Topic Options
#149108 - 2005-10-03 05:34 PM Local Administrator Account Audit for Servers
Mehmet Offline
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 Offline
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 Offline
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
#149111 - 2005-10-03 07:55 PM Re: Local Administrator Account Audit for Servers
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Yes, it's all possible. Please take a look at the manual that comes with KiXtart. It will show you how to do each task you ask. If you need further assistance after taking a look at the manual please let us know and we'll try to help you out.
Top
#149112 - 2005-10-03 08:05 PM Re: Local Administrator Account Audit for Servers
Mehmet Offline
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 Offline
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
#149114 - 2005-10-03 09:00 PM Re: Local Administrator Account Audit for Servers
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:

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




We all needed to learn to walk before trying to run

It's much better if you also understand what the script does and not just use it. Problems will come sooner or later and then you can't fix them that’s why it's better to learn kix before using kix.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#149115 - 2005-10-03 09:09 PM Re: Local Administrator Account Audit for Servers
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Nice maciep but doesn't list if the accounts are LOCAL or from a DOMAIN
Top
#149116 - 2005-10-03 09:42 PM Re: Local Administrator Account Audit for Servers
maciep Offline
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 Offline
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 Offline
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
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 641 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.062 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org