I recently started using the Win32::NetAdmin module to assist with routine auditing tasks. For this, I put together the following script that will collect account info on a server.
The problem is, I would like to also include the groups defined on any given server as part of the output of this script...something comparable to GetUsers, such as GetGroups perhaps. Looking through Win32::NetAdmin, it does not appear that this feature is available...I could be wrong though. Any ideas on this?#!perlenv -w use strict; use Win32::NetAdmin qw(UserGetAttributes GetUsers); my @users; my $server = $ARGV[0]; if ( $#ARGV < 0 ) { print "usage: ntinfo.pl <server IP address>"; exit; } GetUsers( $server, 0, \@users ); my ( $user, $password, $passwordAge, $privilege, $homeDir, $comment, $ +flags, $scriptPath ); foreach $user (@users) { UserGetAttributes( $server, $user, $password, $passwordAge, \$privilege, $homeDir, $comment, $flags, $scriptPath ); my $current = time(); my $days = $current - $passwordAge; print "$user:" . scalar( localtime($days) ) . ":$comment\n"; }
cheers, -semio
In reply to using perl to collect NT groups by semio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |