[prev in list] [next in list] [prev in thread] [next in thread]
List: perl-win32-admin
Subject: replacing permissions & ownership
From: James McDermet <mcdermet () lsil ! com>
Date: 2001-05-22 18:32:00
[Download RAW message or body]
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
Perl-Win32-Admin@listserv.ActiveState.com
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic