Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Server Security > Audit For Privileged Accounts

Reply
Thread Tools Display Modes

Audit For Privileged Accounts

 
 
Venkatesh
Guest
Posts: n/a

 
      04-08-2009
Hi there,

Is there is a command-line or script available which can generate a report
of all accounts with administrator equivalent privileges in Windows AD setup,
with added information on which machine the id resides., etc?

Thanks,
Venkatesh
 
Reply With Quote
 
 
 
 
Meinolf Weber [MVP-DS]
Guest
Posts: n/a

 
      04-08-2009
Hello Venkatesh,

From another posting:

You can use the script below to generate a report on local Administrators
and Power Users. Copy it into a text file and rename it with the .vbs extension.
Run it from the domain controller. For the computers you are auditing, you
must have Administrator privileges and be able to access the computer's RPC
ports. The output is tab delimited and can be opened in Excel.

'--------------------------------------------------------------------------------

Set oADInfo = CreateObject("ADSystemInfo")
Set oFso = WScript.CreateObject("Scripting.Filesystemobject")
Set oShell = WScript.CreateObject("Wscript.Shell")

LogPath = oShell.SpecialFolders("MyDocuments") + "\Privileged Local
User Audit.txt"
AdsiPath = "WinNT://" + oADInfo.DomainShortName
tab = Chr(9)

' Connect to Active Directory

Set ADComputers = GetObject(AdsiPath)
ADComputers.Filter = Array("Computer")

' Open the log file

Set oLog = oFso.CreateTextfile(LogPath, true)
oLog.WriteLine "Privileged Local Users on Computers in the " + _
oADInfo.DomainDNSName + _
" domain."
oLog.WriteLine Now
oLog.WriteLine ""
oLog.WriteLine "Computer" + tab + _
"Administrators" + tab + _
"Administrators Groups" + tab + _
"Power Users" + tab + _
"Power Users Groups"

' Check each computer

For Each oComputer in ADComputers

' Trap any errors in case the user is unauthorized, the computer is
inaccessible, etc.
On Error Resume Next

' Get the Administrators users and groups

AdminUsers = ""
AdminGroups = ""
Set objGroup = GetObject("WinNT://" & oComputer.Name & "/
Administrators")
If Not(Err.Number = 0) Then
AdminUsers = Err.Number
AdminGroups = Err.Number
End If

For Each objUser In objGroup.Members
If objUser.Class = "User" Then
AdminUsers = AdminUsers + objUser.Name + "; "
else
AdminGroups = AdminGroups + objUser.Name + "; "
end if
Next

' Get the Power Users users and groups

PowerUsers = ""
PowerGroups = ""
Set objGroup = GetObject("WinNT://" & oComputer.Name & "/Power
Users")
If Not(Err.Number = 0) Then
PowerUsers = Err.Number
PowerGroups = Err.Number
End If

For Each objUser In objGroup.Members
If objUser.Class = "User" Then
PowerUsers = PowerUsers + objUser.Name + "; "
else
PowerGroups = PowerGroups + objUser.Name + "; "
end if
Next

' Output to the log

oLog.WriteLine oComputer.Name + tab + _
AdminUsers + tab + _
AdminGroups + tab + _
PowerUsers + tab + _
PowerGroups

Next

' Close log file handle, open the log in Notepad

oLog.Close
oShell.Run "notepad.exe """ + LogPath + """"

' Clean up

Set ADComputers = Nothing
Set oADInfo = Nothing
Set oFso = Nothing
Set oLog = Nothing
Set oLog = Nothing
Set oShell = Nothing

'--------------------------------------------------------------------------------


Best regards

Meinolf Weber
Disclaimer: This posting is provided "AS IS" with no warranties, and confers
no rights.
** Please do NOT email, only reply to Newsgroups
** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm


> Hi there,
>
> Is there is a command-line or script available which can generate a
> report of all accounts with administrator equivalent privileges in
> Windows AD setup, with added information on which machine the id
> resides., etc?
>
> Thanks,
> Venkatesh



 
Reply With Quote
 
Al Dunbar
Guest
Posts: n/a

 
      04-09-2009

"Meinolf Weber [MVP-DS]" <meiweb(nospam)@gmx.de> wrote in message
news: .com...
> Hello Venkatesh,
>
> From another posting:
>
> You can use the script below to generate a report on local Administrators
> and Power Users. Copy it into a text file and rename it with the .vbs
> extension. Run it from the domain controller. For the computers you are
> auditing, you must have Administrator privileges and be able to access the
> computer's RPC ports. The output is tab delimited and can be opened in
> Excel.


A quick reading of this script suggests to me that it may not list accounts
that get their admin privs indirectly through AD group nesting.

/Al

> '--------------------------------------------------------------------------------
>
> Set oADInfo = CreateObject("ADSystemInfo")
> Set oFso = WScript.CreateObject("Scripting.Filesystemobject")
> Set oShell = WScript.CreateObject("Wscript.Shell")
>
> LogPath = oShell.SpecialFolders("MyDocuments") + "\Privileged Local
> User Audit.txt"
> AdsiPath = "WinNT://" + oADInfo.DomainShortName
> tab = Chr(9)
>
> ' Connect to Active Directory
>
> Set ADComputers = GetObject(AdsiPath)
> ADComputers.Filter = Array("Computer")
>
> ' Open the log file
>
> Set oLog = oFso.CreateTextfile(LogPath, true)
> oLog.WriteLine "Privileged Local Users on Computers in the " + _
> oADInfo.DomainDNSName + _
> " domain."
> oLog.WriteLine Now
> oLog.WriteLine ""
> oLog.WriteLine "Computer" + tab + _
> "Administrators" + tab + _
> "Administrators Groups" + tab + _
> "Power Users" + tab + _
> "Power Users Groups"
>
> ' Check each computer
>
> For Each oComputer in ADComputers
>
> ' Trap any errors in case the user is unauthorized, the computer is
> inaccessible, etc.
> On Error Resume Next
>
> ' Get the Administrators users and groups
>
> AdminUsers = ""
> AdminGroups = ""
> Set objGroup = GetObject("WinNT://" & oComputer.Name & "/
> Administrators")
> If Not(Err.Number = 0) Then
> AdminUsers = Err.Number
> AdminGroups = Err.Number
> End If
>
> For Each objUser In objGroup.Members
> If objUser.Class = "User" Then
> AdminUsers = AdminUsers + objUser.Name + "; "
> else
> AdminGroups = AdminGroups + objUser.Name + "; "
> end if
> Next
>
> ' Get the Power Users users and groups
>
> PowerUsers = ""
> PowerGroups = ""
> Set objGroup = GetObject("WinNT://" & oComputer.Name & "/Power
> Users")
> If Not(Err.Number = 0) Then
> PowerUsers = Err.Number
> PowerGroups = Err.Number
> End If
>
> For Each objUser In objGroup.Members
> If objUser.Class = "User" Then
> PowerUsers = PowerUsers + objUser.Name + "; "
> else
> PowerGroups = PowerGroups + objUser.Name + "; "
> end if
> Next
>
> ' Output to the log
>
> oLog.WriteLine oComputer.Name + tab + _
> AdminUsers + tab + _
> AdminGroups + tab + _
> PowerUsers + tab + _
> PowerGroups
>
> Next
>
> ' Close log file handle, open the log in Notepad
>
> oLog.Close
> oShell.Run "notepad.exe """ + LogPath + """"
>
> ' Clean up
>
> Set ADComputers = Nothing
> Set oADInfo = Nothing
> Set oFso = Nothing
> Set oLog = Nothing
> Set oLog = Nothing
> Set oShell = Nothing
>
> '--------------------------------------------------------------------------------
>
>
> Best regards
>
> Meinolf Weber
> Disclaimer: This posting is provided "AS IS" with no warranties, and
> confers no rights.
> ** Please do NOT email, only reply to Newsgroups
> ** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm
>
>> Hi there,
>>
>> Is there is a command-line or script available which can generate a
>> report of all accounts with administrator equivalent privileges in
>> Windows AD setup, with added information on which machine the id
>> resides., etc?
>>
>> Thanks,
>> Venkatesh

>
>



 
Reply With Quote
 
Ace Fekay [Microsoft Certified Trainer]
Guest
Posts: n/a

 
      04-16-2009
"Venkatesh" <> wrote in message
news:75B59488-6FA0-4650-9981-...
> Hi there,
>
> Is there is a command-line or script available which can generate a report
> of all accounts with administrator equivalent privileges in Windows AD
> setup,
> with added information on which machine the id resides., etc?
>
> Thanks,
> Venkatesh



Can you elaborate on what you mean by Windows AD setup?

Do you mean you need a script to generate a report to enumerate accounts,
for example, in the Administrators group?

--
Ace

This posting is provided "AS-IS" with no warranties or guarantees and
confers no rights.

Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSA Messaging, MCT
Microsoft Certified Trainer


For urgent issues, you may want to contact Microsoft PSS directly. Please
check http://support.microsoft.com for regional support phone numbers.

 
Reply With Quote
 
Venkatesh
Guest
Posts: n/a

 
      05-07-2009
Hi Ace,

Yes that's exactly what I need.

Script which can scan domain member servers (in batches) and enumerate
accounts or domain groups which are the members of local Administrator group.

Thank you.
V

"Ace Fekay [Microsoft Certified Trainer]" wrote:

> "Venkatesh" <> wrote in message
> news:75B59488-6FA0-4650-9981-...
> > Hi there,
> >
> > Is there is a command-line or script available which can generate a report
> > of all accounts with administrator equivalent privileges in Windows AD
> > setup,
> > with added information on which machine the id resides., etc?
> >
> > Thanks,
> > Venkatesh

>
>
> Can you elaborate on what you mean by Windows AD setup?
>
> Do you mean you need a script to generate a report to enumerate accounts,
> for example, in the Administrators group?
>
> --
> Ace
>
> This posting is provided "AS-IS" with no warranties or guarantees and
> confers no rights.
>
> Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSA Messaging, MCT
> Microsoft Certified Trainer
>
>
> For urgent issues, you may want to contact Microsoft PSS directly. Please
> check http://support.microsoft.com for regional support phone numbers.
>
>

 
Reply With Quote
 
Venkatesh
Guest
Posts: n/a

 
      05-07-2009
Yes that's right, enumerate Administrator groups of Member servers.

"Ace Fekay [Microsoft Certified Trainer]" wrote:

> "Venkatesh" <> wrote in message
> news:75B59488-6FA0-4650-9981-...
> > Hi there,
> >
> > Is there is a command-line or script available which can generate a report
> > of all accounts with administrator equivalent privileges in Windows AD
> > setup,
> > with added information on which machine the id resides., etc?
> >
> > Thanks,
> > Venkatesh

>
>
> Can you elaborate on what you mean by Windows AD setup?
>
> Do you mean you need a script to generate a report to enumerate accounts,
> for example, in the Administrators group?
>
> --
> Ace
>
> This posting is provided "AS-IS" with no warranties or guarantees and
> confers no rights.
>
> Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSA Messaging, MCT
> Microsoft Certified Trainer
>
>
> For urgent issues, you may want to contact Microsoft PSS directly. Please
> check http://support.microsoft.com for regional support phone numbers.
>
>

 
Reply With Quote
 
Ace Fekay [Microsoft Certified Trainer]
Guest
Posts: n/a

 
      05-07-2009
"Venkatesh" <> wrote in message
news:39576E49-FB82-42F4-85F4-...
> Hi Ace,
>
> Yes that's exactly what I need.
>
> Script which can scan domain member servers (in batches) and enumerate
> accounts or domain groups which are the members of local Administrator
> group.
>
> Thank you.
> V


Ok. See if these help:

Dump Group Membership To A Tab Delimited Text File... ( Vbscript )
http://cwashington.netreach.net/depo...tType=vbscript

I've used CWashington's scripts for this same task, but I used it to dump
the whole domain so I can audit everything. There are others at
CWashington's site. Just go to http://cwashington.netreach.net and click on
VBDScript, and search "Group Members"

Tutorial for VBScript. Example enumerate members of a Windows groupOur
Mission and Goal; Example 1: Discovering who is a member of the
Administrators Group; VBScript Tutorial: Learning Points for Enumerating a
Group ...
http://www.computerperformance.co.uk...te_members.htm

Microsoft Certified Professional Magazine Online | Column: Easy ...Nov 15,
2006 ... Here is a script that will enumerate all local administrator group
members for every computer in your domain, and store the results in a ...
http://mcpmag.com/columns/article.asp?EditorialsID=1538

I hope that helps.

--
Ace

This posting is provided "AS-IS" with no warranties or guarantees and
confers no rights.

Ace Fekay, MCSE 2003 & 2000, MCSA 2003 & 2000, MCSA Messaging, MCT
Microsoft Certified Trainer


For urgent issues, you may want to contact Microsoft PSS directly. Please
check http://support.microsoft.com for regional support phone numbers.

"Efficiency is doing things right; effectiveness is doing the right
things." - Peter F. Drucker
http://twitter.com/acefekay

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
aministrator privileged Richard Windows Vista General Discussion 1 02-21-2008 05:28 PM
Registry in a Least Privileged Environment will f Windows Vista General Discussion 4 03-12-2007 06:13 PM
Least-privileged User Account White Paper Andrew M. Saucci, Jr. Windows Small Business Server 2 02-07-2006 06:17 AM
Audit User Accounts on DC showing Last Logon Time Juneday Active Directory 5 10-11-2005 01:53 PM
Implementing a privileged IOCTL Ilya Konstantinov Windows Vista Drivers 4 09-15-2005 09:39 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59