Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

That's one small step for a pwhysall...

by pwhysall (Acolyte)
on Feb 20, 2001 at 19:42 UTC ( #59674=note: print w/replies, xml ) Need Help??


in reply to List of groups on Win32

The first task was to print a comma separated list of users and groups:
#!/usr/bin/perl -w use Win32::AdminMisc; use Win32::NetAdmin qw (GroupGetMembers); use strict; my $dc; my @groups; $dc = Win32::AdminMisc::GetDC(); Win32::AdminMisc::GetGroups($dc, GROUP_TYPE_ALL, \@groups); my $item; my %groups_with_users; foreach $item(@groups) { my @tmp_user_list; GroupGetMembers($dc, $item, \@tmp_user_list); $groups_with_users{$item} = [@tmp_user_list]; } my $group; open USERGROUP, ">usergroup.csv" || die "Can't open file for writing:$ +!"; print USERGROUP "Group, User\n"; foreach $item(keys %groups_with_users) { my $i; foreach $i (0 .. $#{ $groups_with_users{$item} } ) { print USERGROUP "$item, $groups_with_users{$item}[$i]\n"; } } close USERGROUP;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://59674]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2019-10-22 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?