I am working on a domain with screwed up file permissions.  The script
below recursively lists the permissions for each file/dir and if it
contains Domain Admins, replaces it with a global group called IT
Support.  The problem is that Administrators are locked out of some
directories and therefore permissions cannot be modified.

Is there a way to take ownership of the files/dirs while maintaining the
existing permissions?  The code below is very slow so I would also
appreciate any ideas of how to speed this up as it will be running
against GBs of data.

James


use File::Find;
use Win32::FileSecurity;

find( \&foo, 'c:\test');

sub foo {
    undef %perms;
    undef %newPerms;
    Win32::FileSecurity::Get( $_, \%perms)|| warn $!;

    while (($name,$value) = each %perms) {
        print "$_ $name $value\n";
        if ($name =~ /domain admins/i){
            $newPerms{'DOMAIN\IT Support'} = $value;
        }else{
            $newPerms{$name} = $value;
        }
        $newPerms{'Administrators'} = $value;
    }
    Win32::FileSecurity::Set( $_, \%newPerms);
}


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to