Re: EnumLocalGroup - fails when "NT AUTORITY/SYSTEM" is member of group
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 22 Jul 2008 14:15:16 -0500
"Mack" <mbarss@xxxxxxx> wrote in message
news:d218b4d9-3605-4a3c-9ad6-f51b6bf3ae44@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello Group,
I am using modified version of Richard Muellars script to enumerate
members of the local group.
What I am finding is the the script fails when it hits a server that
has "NT AUTHORITY/SYSTEM" indicated in the local Administrators
group.
Is there anyway to have the script either to ignore the entry and go
on to the next entry in the local administartor group?
The script fails in the EnumDomainGroup routine for
objTrans.Set ADS_NAME_TYPE_NT4, strNTName
' NameTranslate already setup. Check if objDomainGroup
' bound with WinNT.
If (blnNT = True) Then
' Convert NetBIOS name of group to Distinguished Name.
strNTName = strNetBIOSDomain & "\" & objDomainGroup.Name
strGroupDN = objTrans.Get(ADS_NAME_TYPE_1779)objTrans.Set ADS_NAME_TYPE_NT4, strNTName
Else
' objDomainGroup bound with LDAP. Retrieve Distinguished
Name.
strGroupDN = objDomainGroup.distinguishedName
End If
Any help is greatly appreciated as I am not skilled with vbs
scripting.
Malcolm
.. snip.
The problem is that these objects, well known security principals, do not
have NT (or NetBIOS) names (of form ADS_NAME_TYPE_NT4). This includes Self,
Everyone, Service, System, Local Service, etc. They are in the AD container
"cn=WellKnown Security Principals,cn=Configuration,dc=MyDomain,dc=com". What
confuses me is that Sub EnumDomainGroup should only be called if the member
of the local group is a group, and "NT Authority\System" is not a group. I'm
going to have to experiment with this.
For now, one solution would be search for the string "NT AUTHORITY" and exit
the sub. Another solution is to trap the error. For example:
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strNTName
If (Err.Number <> 0) Then
On Error GoTo 0
Exit Sub
End If
On Error GoTo 0
This assumes there is no need to bind to the object (hence exit the sub)
since there cannot be members.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
.
- Follow-Ups:
- References:
- Prev by Date: Login Script to Read AD First and Last Name
- Next by Date: Re: EnumLocalGroup - fails when "NT AUTORITY/SYSTEM" is member of group
- Previous by thread: EnumLocalGroup - fails when "NT AUTORITY/SYSTEM" is member of group
- Next by thread: Re: EnumLocalGroup - fails when "NT AUTORITY/SYSTEM" is member of group
- Index(es):
Relevant Pages
|