Re: Scripting for local user admin

Tech-Archive recommends: Fix windows errors by optimizing your registry



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

.



Relevant Pages

  • Re: Windows Firewall
    ... Log on as local admin ... Log on as the local user, logoff, reboot ... Copy the profile from the domain account to the new local account you ...
    (microsoft.public.windowsxp.configuration_manage)
  • Re: Cant log on, no domain!
    ... local admin or another local account. ... > default guest or administrator account I can get on to to ... > get the Doman choice back? ...
    (microsoft.public.win2000.security)