Re: Scripting for local user admin
- From: "billy" <wcasse@xxxxxxxxx>
- Date: 10 Apr 2005 18:22:01 -0700
i wrote a complete auditing program using vbscript that i think is as
good as anything commercial. here are some snippets on how i gathered
this information.
i found that getting current user from the registry to be more reliable
(i always got a value with this method, not so with WMI). also,
..ADsPath will get you the logon domain - which is important for telling
the difference between a local account and a domain account.
'start with a loop of your choice to set CompName
'to get current user, read the registry on the computer:
InfoPath = "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\"
UserID = WshShell.RegRead(InfoPath & "DefaultDomainName") & "/" _
& WshShell.RegRead(InfoPath & "DefaultUserName")
'to get all admins:
Set objLocalAdminGroup = GetObject("WinNT://" & CompName &
"/Administrators")
For Each objLocalAdmin In objLocalAdminGroup.Members
AdminID = Mid(objLocalAdmin.ADsPath,9)
If AdminID = UserID Then
'do something
End If
Next
'complete loop
zod wrote:
> I am looking for a script that I can run that will search
> all computers in my windows 2000 domain, display the
> username logged on and see if that user has local admin
> rights to his local machine
>
> Any help?
>
> Thanks
.
- References:
- Scripting for local user admin
- From: zod
- Scripting for local user admin
- Prev by Date: open/focus one of many windows in app
- Next by Date: Re: IExplore.exe
- Previous by thread: RE: Scripting for local user admin
- Next by thread: Editing the nth byte of a BINARY Registry Value
- Index(es):
Relevant Pages
|