Scripted Enumeration of Accounts with Local Admin Rights


Beefing up security on networks keeps you from having issues in the long run. An hour today can save you three later. In a effort to improve network security and individual computer security I came up with this fancy little kaseya script.  It enumerates the local administrators on a computer and exports them to a text file named whatever the target computer has been named. This can also be run through a batch login script. In the example below “g:” is a admin share on my local server, you can make this what ever you want or use a get file in kaseya to snatch the text file from the computer.


[ad]

Script Name: Get Local Administrators
Script Description: Enumerates what users are members of the local admin group.
IF True
THEN
Execute Shell Command
Parameter 1 : net localgroup administrators >> gadmin_audit%computername%.txt
Parameter 2 : 1
OS Type : 0
ELSE

Here is the same thing in a batch file with mapping a share:

Net use g: \server01admin_share
net localgroup administrators >> gadmin_audit%computername%.txt
net use g: /delete

[ad]

,

  1. No comments yet.
(will not be published)