use Win32::Lanman; use Win32::Adminmisc; use Date::Manip; @server=qw(serveur1 serveur2 serveur3); $limite=10000000; $share=""; @exchange=qw(exchange1\\F$ exchange2\\F$ exchange3\\F$ exchange4\\E$); #priv.edb, pub.edb for $server (@server) { @disks=qw(); if(!Win32::Lanman::NetServerDiskEnum("\\\\$server", \@disks)) { # print "error on $server, something went wrong; error: "; # get the error code # print Win32::Lanman::GetLastError(); # exit 1; } foreach $disk (@disks) { $share=$disk; $share=~s/:/\$/; ($nowsec,$nowmin,$nowhour,$nowmday,$nowmon,$nowyear,$nowwday,$nowyday,$nowisdst) = localtime(time()); ($Total, $Free) = Win32::AdminMisc::GetDriveSpace("\\\\$server\\$share\\"); $pourcent=($Free/$Total) * 100 if ($Total ne "" ); printf ("%11s %3s %s%s%s, %s:%s, %3d, %15s, %15s \n",$server,$disk,$nowyear,$nowmon,$nowmday,$nowhour,$nowmin,$pourcent,$Total,$Free) if ($Total ne "" ); } } for $exchange (@exchange) { # Win32::AdminMisc::GetFileInfo("\\\\$exchange\\EXCHSRVR\\MDBDATA\\priv.edb",\%attributes); # if (Win32::AdminMisc::GetFileInfo( "c:\\boot.ini", \%Attribute)){ # print "File has the following copyright: $Attribute{LegalCopyright}\n"; # } # AdminMisc::GetFileInfo("c:\\boot.ini",\%attributes); # foreach (keys %attributes ) # { # print "$exchange PUB.EDB attr $_ : $attributes{$_} \n"; # } undef @res; open PIPE, "dir \\\\$exchange\\EXCHSRVR\\MDBDATA\\*.edb |"; @res = ; close PIPE or die "bad pipe: $?, $!"; for $res (@res) { print "$exchange $res" if ( $res =~/edb/i ); } # }