O'Holly Ones,
I have written the script below to obtain user/group permission information, then I split the 'permissionees' into groups or users. It works (in terms of extracting the information), however, If I grant a local group access permission, the script will detect the changes but it leaves the field "account" empty. It only does this with local groups. example, if I grant the user john, the global group G_group1 and the local group l_group1 access permission to a remote drive (lets say g$) then I get an output like this:
This '' is a group account
This 'john' is a user account
Has anyone came across similar problem? Your replyies are highly appreciated.
use strict;
use Win32::NetResource;
use Win32::AdminMisc;
use Win32::NetAdmin;
use Win32::Perms;
my $drive = shift @ARGV;
my $srv;
my $path;
my $perms;
if (Win32::NetResource::GetUNCName( $path,$drive))
{
$path =~ /^\\\\(\w+)/;
$srv = $&;
print "\nServer " . $srv . "\n";
}
$perms = new Win32::Perms($path) || die "\n$^E\n";
print "\nPath: " . $perms->Path() . "\n";
my $intgr = $perms->Get(\ my @perms);
foreach my $permy (@perms)
{
while (my ($field, $data) = each %{$permy})
{
next if $field !~ /account/i;
if (Win32::NetAdmin::UsersExist('',$data))
{
print "This '$data' is a user account\n";
}
else
{
print "This '$data' is a group account\n";
}
}
print "\n\n";
}
Many Thanks and "A little example can go a long way"
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.