Hi,

Hummm... 
Do you know that exchange can do this for you ? Right-click on Mailbox Store - 
Limits :-)

Yves.
-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Steven Manross
Envoyé : mercredi 30 mai 2007 2:57
À : Perl-Win32-Admin@listserv.ActiveState.com
Objet : RE: List each Storage Limit per user

>From the server...  (or somewhere you have the Exchange Client tools
loaded...)

Obviously a for each loop would be required to loop through all the users, but 
this should get you the nitty gritty details you want once you construct your 
list of users to loop through (if you don't want to do the WMI route).

use Win32::OLE;
 
my $userObjCDO = Win32::OLE->new('CDO.Person'); &PrintError( 'CDO creating 
object CDO.Person'); my $user_obj = 
Win32::OLE->GetObject("LDAP://DOMAINNAME/CN=username,OU=OU
NAME,DC=domain,DC=suffix");
&PrintError( 'opening user account from AD'); my $mailRcpt = 
$userObjCDO->GetInterface( "IMailRecipient"); &PrintError( 'getting 
IMailRecipient interface from CDO.Person'); my $mailStore = 
$userObjCDO->GetInterface( "IMailboxStore"); &PrintError( 'getting 
IMailboxStore interface from CDO.Person'); print "incoming limit: " . 
$mailRcpt->{"IncomingLimit"}."\n";
print "outgoing limit: " . $mailRcpt->{"OutgoingLimit"}."\n";
print "EnableStoreDefaults: " .
$mailStore->{"EnableStoreDefaults"}."\n";
print "StoreQuota: " . $mailStore->{"StoreQuota"}."\n"; print "OverQuotaLimit: 
" . $mailStore->{"OverQuotaLimit"}."\n";
print "Hard Limit: " . $mailStore->{"HardLimit"}."\n"; 

sub PrintError {
  if (Win32::OLE::LastError() != 0) {
    die $_[0]."\n".Win32::OLE::LastError()."\n";
  }
}
 
HTH 

Cheers!

Steven

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, May 29, 2007 4:21 PM
To: Perl-Win32-Admin@listserv.ActiveState.com
Subject: Re: List each Storage Limit per user

Try :

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"
.
                "\tStorageLimitInfo: ......... " .
$mailbox->StorageLimitInfo . "\n" .
                "\tStoreName: ......... " . $mailbox->StoreName . "\n"; } print
"-----------------------------------------------------------------------
--------\n\n";
}

> I am looking to list each user on my exchange server the following: 
> SMTP address, Storage Limit setting.
>
> I already have a list that extracts their current mailbox size.  But I

> need to know their limit so I can see if the current Mailbox size is 
> greater then.. And send them an email..
>
> Thanks in advance,,,
>
> Leo Durocher
> Network Engineer
>   <<Picture (Metafile)>>
>
>
>
> IMPORTANT NOTICE: This message is intended only for the addressee and 
> may contain confidential, privileged information.
> If you are not the intended recipient, you may not use, copy or 
> disclose any information contained in the message.
> If you have received this message in error, please notify the sender 
> by reply e-mail and delete the message.
> _______________________________________________
> Perl-Win32-Admin mailing list
> Perl-Win32-Admin@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



 ====== DISCLAIMER ======

<html><BR><BR><A 
href="http://www.cph.be/maildisclaimer";>http://www.cph.be/maildisclaimer</A></html>
_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to