|
Here's a quick VBS I whipped up to list users and
show which ones are Host, IMail, and List admins.
I didn't take the time to declare variables or
release objects, but this will show you how it can be done.
Darin. ----- Original Message -----
From: Darin Cox
Sent: Saturday, May 21, 2005 10:48 PM
Subject: Re: [IMail Forum] Find Admins I'm not sure which method you're referring
to. A simple VBS script that reads the registry, iterating through the
domain and user keys will do what you want if you use the registry. If you
use ODBC, then you can query the database.
Darin. ----- Original Message -----
From: Moore,Seron
Sent: Saturday, May 21, 2005 4:26 PM
Subject: RE: [IMail Forum] Find Admins That's the method I use
and always have been using. I was looking for something that will spit out the
names of anyone with admin rights. Thanks for the
reply. -----Original
Message----- If you're running with the registry,
then you can write a script to iterate through the IMail domains and users in
the registry and use binary operations on the user flags to determine whether
they are an admin. If you're running on an ODBC database, you can do the
binary math on the appropriate user flags
field. If you look in Ipswitch's knowledge
base there's an article on the user flags.
----- Original Message -----
From: Moore,Seron
Sent:
Subject: [IMail
Forum] Find Admins Hello, I'm looking for a quick and painless
way to find all the users on my IMail box with Admin Privileges. I have a way to
do it that's not too bad but I would like to know if anyone else out there is
doing this and what methods they're using. IMail has a utility called
"fndadm.exe" but that only seems to work for older versions of IMail Server (I'm
running 8.14 HF1). Seron
Moore IT
Support / Apps & Dev. Information
Technology Department Cable
Bahamas Ltd ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Robinson
& P.O.
Box CB-13050 Support
line :( 242) 356-8900 - (242) 300-8900 Fax:
(242) 356-8969 |
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer
& "\root\default:StdRegProv")
strKeyPath = "Software\Ipswitch\IMail\Domains"
' List the Domain keys
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If left(subkey,8) <> "$virtual" Then
' Find the domains keys with a Users key
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, arrSubKeys2
If not isnull(arrSubKeys2) Then
For Each subkey2 In arrSubKeys2
If subkey2 = "Users" Then
StdOut.WriteLine "Domain: " & subkey
' List the users
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey &
"\Users", arrSubKeys3
If not isnull(arrsubkeys3) Then
For each subkey3 in arrSubKeys3
If subkey3 <> "_aliases" and subkey3 <> "root" Then
StdOut.Write " " & subkey3
' Are they admins?
strValueName = "Flags"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" &
subkey & "\Users" & "\" & subkey3, strValueName, dwValue
'bitHostAdmin = dwValue AND 0x100
If (dwValue AND &H100) Then StdOut.Write " (Host Admin)"
If (dwValue AND &H200) Then StdOut.Write " (Imail Admin)"
If (dwValue AND &H400) Then StdOut.Write " (List Admin)"
StdOut.WriteLine
End If
Next
End If
End If
Next
End If
End If
Next
