On Tue, 29 Jun 2004 12:50:14 -0400, perl.org wrote
> Thanks. So I have to pass the SID to some other function to get the
> actual username? or call a different function? I tried
> LocalGroupGetMembersWithDomain (which should give domain\users) but
> it's not any better and it returns non-zero (error) without
> providing any information about the error?
When in doubt, shell out.
sub getGroupMembers
{
my %{params} = IWAPI::SysUtil::normalizeParams( @{_} );
my @{users} = ();
my %{results} = IWAPI::SysUtil::run( -cmd => 'net localgroup ' .
${params{'group'}} );
if ( ${results{'ret'}} != 0 || ${results{'out'}} !~ m#The command completed
successfully# )
{
new IWAPI::Exception( -file => __FILE__, -line => __LINE__, -msg =>
${results{'msg'}} );
}
my ${parse} = undef;
foreach my ${line} ( split( /[\r\n]+/, ${results{'out'}} ))
{
if ( ${line} =~ m#^-{40}# )
{
${parse} = 1;
}
elsif ( defined( ${parse} ) && ${line} !~ m#\\# )
{
${line} =~ s#\s+$##;
if ( ${line} ne '' && ${line} !~ m#The command completed successfully# )
{
push( @{users}, ${line} );
}
}
}
return( @{users} );
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>