Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
use strict; use Win32::FileSecurity qw(Get EnumerateRights); use File::Find; my $share=$ARGV[0]; my $out=$ARGV[1]; my ($name,$mask,@rights,%hash,$server,%rights2,@folders,$subfolder,$se +rvsplit,$subsplit,$right,$item); my @servers=('SERVERXX','SERVERXX','SERVERXX','SERVERXX','SERVERXX','S +ERVERXX','SERVERXX','SERVERXX','SERVERXX','SERVERXX','SERVERXX','SERV +ERXX','SERVERXX','SERVERXX','SERVERXX','SERVERXX','SERVERXX','SERVERX +X'); @servers=map ("//$_/$share",@servers); my @rightsmatch=('DELETE','READ_CONTROL','WRITE_DAC','WRITE_OWNER','SY +NCHRONIZE','STANDARD_RIGHTS_REQUIRED','STANDARD_RIGHTS_READ','STANDAR +D_RIGHTS_WRITE','STANDARD_RIGHTS_EXECUTE','STANDARD_RIGHTS_ALL','SPEC +IFIC_RIGHTS_ALL','ACCESS_SYSTEM_SECURITY','MAXIMUM_ALLOWED','GENERIC_ +READ','GENERIC_WRITE','GENERIC_EXECUTE','GENERIC_ALL','FULL','READ',' +CHANGE'); open (OUT, ">$out") or die "can't open log file!"; foreach $server( @servers ) { print "$server\n"; @folders=''; find(\&wanted, $server); foreach $subfolder (@folders){ print "\t:$subfolder\n"; next unless -e $subfolder ; if ( Get( $subfolder, \%hash ) ) { while( ($name, $mask) = each %hash ) { ($servsplit,$servsplit,$servsplit,$subsplit)=split(/\//,$subfo +lder,4); print OUT "$servsplit\t$subsplit\t$name\t"; EnumerateRights( $mask, \@rights ) ;#creates @rights, a list o +f rights for the account %rights2=(); foreach $right (@rights){ $rights2{$right} = 1; } foreach $item (@rightsmatch){ if (exists $rights2{$item}){ print OUT "$item\t"; }else{ print OUT "\'\t"; } } print OUT "\n"; } } else { print( "Error #", int( $! ), ": $!" ) ; } } } close OUT; sub wanted { if (-d){ push @folders, "$File::Find::dir/$_"; } }

In reply to Compare Directories/Permissions across all servers by OzzyOsbourne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found