Thanks for all the help guys, I wasted most of my day on this when I should have just come to the experts earlier.

martin

Steven Manross wrote:

Is your user really in the root of the domain (or neatly nestled in some
OU/CN somewhere -- that you don't want us to see...)?

use Win32::OLE qw (in);
my $oUser = Win32::OLE->GetObject("LDAP://cn=username,DC=test,DC=ca";);
my (@aGroups, $sGroup);
@aGroups = $oUser->{'memberOf'};
foreach $sGroup (in (@aGroups)) {
   print "Group is: $sGroup\n";
}

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Martin Douglas
Sent: Friday, July 09, 2004 10:23 AM
To: [EMAIL PROTECTED]
Subject: adsi user groups enumeration


All I want to do is print out the groups a user belongs to. I searched the list for 'group' but came up with nothing.


Here is my code:

#! C:\perl\bin\perl

use strict;
use warnings;
# script modules usage
use Win32::OLE;                # base functionality
# attach to user and
my $oUser = Win32::OLE->GetObject("LDAP://cn=username,DC=test,DC=ca";);
my (@aGroups, $sGroup);
@aGroups = $oUser->GetEx('memberOf');
foreach $sGroup (@aGroups) {
   print "Group is: $sGroup\n";
}

I have also tried:
@aGroups = $oUser->Groups to no avail.

I definitely is friday afternoon here, I can't get anything done.  Any
help?

martin




-- *****************************************************************

Martin Douglas ([EMAIL PROTECTED])
ITS Network Operations
Information Technology Services
Natural Sciences Centre, Room 209
University of Western Ontario
(519) 661-2111 x81187

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to