Greetings,
I could not find a program that would remove home
dirs/profiles upon removal of domain accounts so I
wrote one. The script detects home dirs and profiles
that have no account associated with them. However I
cannot find any function that will script the deletion
of these directories. Is there any way to do this with
Win32::Perms? From what I've read you cant do anything
recursively with it on net shares. (the getperms.pl
script is just the perms.pl script by Dave Roth)
Thanks for ANY help or suggestions!
- db
Here is what I have:
1 sub chk4badperms {
2 open OUT, ">> $outputfile" || die "Cannot
open $outputfile: $!\n";
3 open(TMP, "$tmpfile") || die "Cannot open
$tmpfile: $!\n";
4 while (<TMP>) {
5 chomp($line = $_);
6 if ($line =~ (/\bPermission/)) {
7 $line2 = $line;
8 } elsif ($line =~ (/\d+\-\d+/)) {
9 print OUT "\n";
10 print OUT "Corrupt $line2\n";
11 print OUT "$line\n\n";
12 }
13 }
14 close TMP;
15 close OUT;
16 }
17
18 print "\nAcessing all user home
directories...this may take awhile...\n";
19
20 $tmpfile = "n:\\temp\\chkhomedirs.tmp";
21 $outputfile = "n:\\temp\\chkhomedirs.log";
22
23 # map users share from file server to h: drive
24 `net use H: \\\\file_server\\users`;
25
26 # zero out the ouput file from previous runs
27 open OUT, "> $outputfile" || die "Cannot open
$outputfile: $!\n";
28 print OUT "\n";
29 close OUT;
30
31 open TMP, "> $tmpfile";
32 foreach $dir (qw/ a b c d e f g h i j k l m n
o p q r s t u v w x y z /) {
33 $dirpath = "H:\\$dir\\*";
34 print TMP `getperms.pl $dirpath`;
35 }
36 close TMP;
37
38 &chk4badperms; # parse the output logfile for
corrupt permissions on home dirs
39
40 open OUT, ">> $outputfile"; # put extra spaces
between home dir ouput and profile output
41 print OUT "\n\n\n";
42 close OUT;
43
44 open TMP, "> $tmpfile";
45 print "\nAcessing all user profile
directories...this may take awhile...\n";
46 foreach $dir (qw/ a b c d e f g h i j k l m n
o p q r s t u v w x y z /) {
47 $dirpath = "H:\\profiles\\$dir\\*";
48 print TMP `getperms.pl $dirpath`;
49 }
50 close TMP;
51
52 &chk4badperms; # parse the output temp file
for corrupt permissions on profiles
53
54 `net use /delete H:`; # remove the mapped
drive
55 print "\nFinished...Results are being
generated in the file: $outputfile\n";
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs