I have the following Perl script that I use to dump Windows 2000 diskquota information.
It works; but very slowly in our domain of approximately 20K users.

use Win32::OLE qw(in);
$drive = shift || die;
# 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/diskquotacontrol/adduser.asp
my $colDiskQuotas =  Win32::OLE->new('Microsoft.Diskquota.1');  
if(0+Win32::OLE->LastError == 0) { # everything ok
    # $path has to be the root of the volume with the quota.
    $colDiskQuotas->Initialize($drive,1);
    $colDiskQuotas->{UserNameResolution} = 1; #Wait while resolving name information.
    if(0+Win32::OLE->LastError == 0) { # everything ok
        foreach my $objUser ( in ($colDiskQuotas) ) {
            $userid = $objUser->{LogonName};
            $quota = int($objUser->{QuotaLimit} / 1024 / 1024); # convert to MB
            $threshold = int($objUser->{QuotaThreshold} / 1024 / 1024);
                $used = int($objUser->{QuotaUsed} / 1024 / 1024);
                print "$userid\t$quota\t$threshold\t$used\n";
        }
    }
    else { $Log_message .= "Could not initialize DiskQuota object "; }
}

you run it with

perl q.pl f:\

or you can map to a remote drive
net use f: \\myserver\j$
perl q.pl f:\

This program does what I need, but it runs incredibly slowly. 

If anyone would have a suggestion or ideas how to improve the performance of this 
script
or an alternative way to get the diskquota information in this format, I would 
appreciate 
your feedback.

Howard Jares
Enterprise System Administrator
University of Houston
713-842-4765
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to