I use this to query Exchange Mailbox and Public Folder sizes locally on
the server:
use Win32::OLE qw(in);
# Get item counts and sizes for each mailbox on the target server
#
my $OLECon=
Win32::OLE->GetObject('winmgmts:\\\\localhost\\root\\MicrosoftExchangeV2')
or die "WMI Connection Failed\n";
my $MailBoxes = $OLECon->ExecQuery("Select * From Exchange_Mailbox") or
die "WMI Query Failed!\n";
print
"-------------------------------------------------------------------------------\n";
print "- Mailbox Size Report
-\n";
print
"-------------------------------------------------------------------------------\n";
foreach my $mailbox (in $MailBoxes) {
print "MailboxDisplayName: ......... " . $mailbox->MailboxDisplayName
. "\n" .
"\tSize: .......... " . $mailbox->Size . "\n" .
"\tTotalItems: ......... " . $mailbox->TotalItems . "\n" .
"\tStoreName: ......... " . $mailbox->StoreName . "\n";
}
print
"-------------------------------------------------------------------------------\n\n";
my $MailBoxes = $OLECon->ExecQuery("Select * From Exchange_PublicFolder")
or die "WMI Query Failed!\n";
print
"-------------------------------------------------------------------------------\n";
print "- Public Folders Size Report
-\n";
print
"-------------------------------------------------------------------------------\n";
foreach my $mailbox (in $MailBoxes) {
print "AddressBookName: ......... " . $mailbox->AddressBookName . "\n" .
"\tSize: .......... " . $mailbox->TotalMessageSize . "\n" .
"\tTotalItems: ......... " . $mailbox->MessageCount . "\n" .
"\tStoreName: ......... " . $mailbox->Path . "\n";
}
How could I do the same thing remotely from a client workstation?
Thanks,
Dax
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs