Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (5)
    As of 2014-04-21 08:46 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (492 votes), past polls