PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > bulk pull of groups and then their members
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
bulk pull of groups and then their members

Réponse
 
LinkBack Outils de la discussion
Vieux 12/09/2007, 00h10   #1
al
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut bulk pull of groups and then their members


I have a vbs script and I've created a sub routine to pull the members
of the groups in one of our OU's. I would like the script to return
all groups and the members that don't meet a certain naming
convention. Here is my subroutine:

*************************************
Sub GetMembers(GroupName)
arrGmembers = "LDAP://OU=x,OU=y,ou=z zz,ou=a,DC=b,DC=c,DC=d,DC=com"

Flag = 0

For Each member In arrGmembers
If (Left(Member,3) <> "ad#_") Then Flag = 1

Next

If Flag Then WScript.Echo GroupName & "Contains non ad#_ accounts!!!
Need to remove"

End Sub
*****************************************

Well I get an error for this line "For Each member In arrGmembers" It
says "Object not a collection" OK so it needs to be a collection? How
do I do that?

Thanks!
al

  Réponse avec citation
Vieux 12/09/2007, 05h56   #2
David Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bulk pull of groups and then their members

Hello Al,

http://www.microsoft.com/technet/scr....mspx?mfr=true

If your script is complete, you never actually performed the query. Try
something like this:

set arrGmembers = GetObject("LDAP://OU=x,OU=y,ou=z zz,ou=a,DC=b,DC=c,DC=d,DC=com")
arrGmembers.GetInfo
arrGmembers = objGroup.GetEx("members")

The other thing that will cause that is if a group has one or fewer members.
In that case, the return is a single item rather than an array/collection.
You can test for that with "IF isArray(arrGmembers) ". Otherwise the for/each
will fail.

Test with groups that have 0, 1 and 2 members. If it works with all three,
then you're set.



> I have a vbs script and I've created a sub routine to pull the members
> of the groups in one of our OU's. I would like the script to return
> all groups and the members that don't meet a certain naming
> convention. Here is my subroutine:
>
> *************************************
> Sub GetMembers(GroupName)
> arrGmembers = "LDAP://OU=x,OU=y,ou=z zz,ou=a,DC=b,DC=c,DC=d,DC=com"
> Flag = 0
>
> For Each member In arrGmembers
> If (Left(Member,3) <> "ad#_") Then Flag = 1
> Next
>
> If Flag Then WScript.Echo GroupName & "Contains non ad#_ accounts!!!
> Need to remove"
>
> End Sub
> *****************************************
> Well I get an error for this line "For Each member In arrGmembers" It
> says "Object not a collection" OK so it needs to be a collection? How
> do I do that?
>
> Thanks!
> al



  Réponse avec citation
Vieux 15/09/2007, 20h10   #3
Richard Mueller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bulk pull of groups and then their members



"David Brown" wrote:

> Hello Al,
>
> http://www.microsoft.com/technet/scr....mspx?mfr=true
>
> If your script is complete, you never actually performed the query. Try
> something like this:
>
> set arrGmembers = GetObject("LDAP://OU=x,OU=y,ou=z zz,ou=a,DC=b,DC=c,DC=d,DC=com")
> arrGmembers.GetInfo
> arrGmembers = objGroup.GetEx("members")
>
> The other thing that will cause that is if a group has one or fewer members.
> In that case, the return is a single item rather than an array/collection.
> You can test for that with "IF isArray(arrGmembers) ". Otherwise the for/each
> will fail.
>
> Test with groups that have 0, 1 and 2 members. If it works with all three,
> then you're set.
>
>
>
> > I have a vbs script and I've created a sub routine to pull the members
> > of the groups in one of our OU's. I would like the script to return
> > all groups and the members that don't meet a certain naming
> > convention. Here is my subroutine:
> >
> > *************************************
> > Sub GetMembers(GroupName)
> > arrGmembers = "LDAP://OU=x,OU=y,ou=z zz,ou=a,DC=b,DC=c,DC=d,DC=com"
> > Flag = 0
> >
> > For Each member In arrGmembers
> > If (Left(Member,3) <> "ad#_") Then Flag = 1
> > Next
> >
> > If Flag Then WScript.Echo GroupName & "Contains non ad#_ accounts!!!
> > Need to remove"
> >
> > End Sub
> > *****************************************
> > Well I get an error for this line "For Each member In arrGmembers" It
> > says "Object not a collection" OK so it needs to be a collection? How
> > do I do that?
> >
> > Thanks!
> > al

>
>
>


This link explains the issues with attributes like memberOf and member:

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

Richard Mueller (MVP)
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h13.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12206 seconds with 11 queries