Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: chech group

HTVi
TV Discussion Newsgroups

chech group
kovas6[ at ]gmail.com 11/14/2008 8:56:36 AM
why this function does'nt check "Domain Users" group???


Function RecursiveIsMember(strGroup, arrGroups, x)
' Return Type: Boolean
' Goes through Nested Groups until either booIsMember is True
or there are no more groups to check

Dim objADSystemInfo, objUser, objGroup
Dim strGroupDN
Dim arrTemp
Dim booIsMember

booIsMember = False

On Error Resume Next
If Not IsArray(arrGroups) Then
Set objADSystemInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" &
objADSystemInfo.UserName)
arrGroups = objUser.GetEx("memberOf")
Set objUser = Nothing
Set objADSystemInfo = Nothing
End If

For Each strGroupDN in arrGroups
Err.Clear
Set objGroup = GetObject("LDAP://" & strGroupDN)
' WScript.Echo Space(x) & objGroup.Get("name")
If Err.Number = 0 Then
If LCase(objGroup.Get("name")) = LCase
(strGroup) Then
booIsMember = True
Exit For
Else
Err.Clear
arrTemp = objGroup.GetEx("memberOf")
If Err.Number = 0 Then
y = x + 2
booIsMember = RecursiveIsMember
(strGroup, arrTemp, y)
If booIsMember = True Then
Exit For
End If
End If
End If
End If
Set objGroup = Nothing
Next
On Error Goto 0
RecursiveIsMember = booIsMember
End Function
Re: chech group
kovas6[ at ]gmail.com 11/14/2008 12:50:52 PM
On 14 Lap, 10:56, kov...[ at ]gmail.com wrote:
[Quoted Text]
> why this function does'nt check "Domain Users" group???
>
> Function RecursiveIsMember(strGroup, arrGroups, x)
>         ' Return Type: Boolean
>         ' Goes through Nested Groups until either booIsMember is True
> or there are no more groups to check
>
>         Dim objADSystemInfo, objUser, objGroup
>         Dim strGroupDN
>         Dim arrTemp
>         Dim booIsMember
>
>         booIsMember = False
>
>         On Error Resume Next
>         If Not IsArray(arrGroups) Then
>                 Set objADSystemInfo = CreateObject("ADSystemInfo")
>                 Set objUser = GetObject("LDAP://" &
> objADSystemInfo.UserName)
>                 arrGroups = objUser.GetEx("memberOf")
>                 Set objUser = Nothing
>                 Set objADSystemInfo = Nothing
>         End If
>
>         For Each strGroupDN in arrGroups
>                 Err.Clear
>                 Set objGroup = GetObject("LDAP://" & strGroupDN)
>                 ' WScript.Echo Space(x) & objGroup.Get("name")
>                 If Err.Number = 0 Then
>                         If LCase(objGroup.Get("name")) = LCase
> (strGroup) Then
>                                 booIsMember = True
>                                 Exit For
>                         Else
>                                 Err.Clear
>                                 arrTemp = objGroup.GetEx("memberOf")
>                                 If Err.Number = 0 Then
>                                         y = x + 2
>                                         booIsMember = RecursiveIsMember
> (strGroup, arrTemp, y)
>                                         If booIsMember = True Then
>                                                 Exit For
>                                         End If
>                                 End If
>                         End If
>                 End If
>                 Set objGroup = Nothing
>         Next
>         On Error Goto 0
>         RecursiveIsMember = booIsMember
> End Function

I found that "Domain Users" is the primary group, how to fix the
script to check priemary grooups also,

many thanks
Re: chech group
"Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> 11/14/2008 1:32:12 PM

<kovas6[ at ]gmail.com> wrote in message
news:c271528e-17d9-4ae7-a75a-aa42306a5a0b[ at ]p35g2000prm.googlegroups.com...
On 14 Lap, 10:56, kov...[ at ]gmail.com wrote:
[Quoted Text]
> why this function does'nt check "Domain Users" group???
>
> Function RecursiveIsMember(strGroup, arrGroups, x)
> ' Return Type: Boolean
> ' Goes through Nested Groups until either booIsMember is True
> or there are no more groups to check
>
> Dim objADSystemInfo, objUser, objGroup
> Dim strGroupDN
> Dim arrTemp
> Dim booIsMember
>
> booIsMember = False
>
> On Error Resume Next
> If Not IsArray(arrGroups) Then
> Set objADSystemInfo = CreateObject("ADSystemInfo")
> Set objUser = GetObject("LDAP://" &
> objADSystemInfo.UserName)
> arrGroups = objUser.GetEx("memberOf")
> Set objUser = Nothing
> Set objADSystemInfo = Nothing
> End If
>
> For Each strGroupDN in arrGroups
> Err.Clear
> Set objGroup = GetObject("LDAP://" & strGroupDN)
> ' WScript.Echo Space(x) & objGroup.Get("name")
> If Err.Number = 0 Then
> If LCase(objGroup.Get("name")) = LCase
> (strGroup) Then
> booIsMember = True
> Exit For
> Else
> Err.Clear
> arrTemp = objGroup.GetEx("memberOf")
> If Err.Number = 0 Then
> y = x + 2
> booIsMember = RecursiveIsMember
> (strGroup, arrTemp, y)
> If booIsMember = True Then
> Exit For
> End If
> End If
> End If
> End If
> Set objGroup = Nothing
> Next
> On Error Goto 0
> RecursiveIsMember = booIsMember
> End Function

I found that "Domain Users" is the primary group, how to fix the
script to check priemary grooups also,

many thanks

============
One of these examples should help:

http://www.rlmueller.net/freecode1.htm

The best method to retrieve all security group memberships, nested, primary,
etc., but not distribution or cross-domain memberships, is to use the
tokenGroups attribute. Example 5 in the link for example.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


Re: chech group
kovas6[ at ]gmail.com 12/12/2008 6:10:51 PM
On 14 Lap, 15:32, "Richard Mueller [MVP]" <rlmueller-
nos...[ at ]ameritech.nospam.net> wrote:
[Quoted Text]
> <kov...[ at ]gmail.com> wrote in message
>
> news:c271528e-17d9-4ae7-a75a-aa42306a5a0b[ at ]p35g2000prm.googlegroups.com...
> On 14 Lap, 10:56, kov...[ at ]gmail.com wrote:
>
>
>
>
>
> > why this function does'nt check "Domain Users" group???
>
> > Function RecursiveIsMember(strGroup, arrGroups, x)
> > ' Return Type: Boolean
> > ' Goes through Nested Groups until either booIsMember is True
> > or there are no more groups to check
>
> > Dim objADSystemInfo, objUser, objGroup
> > Dim strGroupDN
> > Dim arrTemp
> > Dim booIsMember
>
> > booIsMember = False
>
> > On Error Resume Next
> > If Not IsArray(arrGroups) Then
> > Set objADSystemInfo = CreateObject("ADSystemInfo")
> > Set objUser = GetObject("LDAP://" &
> > objADSystemInfo.UserName)
> > arrGroups = objUser.GetEx("memberOf")
> > Set objUser = Nothing
> > Set objADSystemInfo = Nothing
> > End If
>
> > For Each strGroupDN in arrGroups
> > Err.Clear
> > Set objGroup = GetObject("LDAP://" & strGroupDN)
> > ' WScript.Echo Space(x) & objGroup.Get("name")
> > If Err.Number = 0 Then
> > If LCase(objGroup.Get("name")) = LCase
> > (strGroup) Then
> > booIsMember = True
> > Exit For
> > Else
> > Err.Clear
> > arrTemp = objGroup.GetEx("memberOf")
> > If Err.Number = 0 Then
> > y = x + 2
> > booIsMember = RecursiveIsMember
> > (strGroup, arrTemp, y)
> > If booIsMember = True Then
> > Exit For
> > End If
> > End If
> > End If
> > End If
> > Set objGroup = Nothing
> > Next
> > On Error Goto 0
> > RecursiveIsMember = booIsMember
> > End Function
>
> I found that "Domain Users" is the primary group, how to fix the
> script to check priemary grooups also,
>
> many thanks
>
> ============
> One of these examples should help:
>
> http://www.rlmueller.net/freecode1.htm
>
> The best method to retrieve all security group memberships, nested, primary,
> etc., but not distribution or cross-domain memberships, is to use the
> tokenGroups attribute. Example 5 in the link for example.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab -http://www.rlmueller.net
> --- Slëpti cituojamà tekstà -
>
> - Rodyti cituojamà tekstà -

thanks Richard

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen