Link to home
Start Free TrialLog in
Avatar of ALogvin
ALogvinFlag for United States of America

asked on

Check the Mailbox size of a remote user via C#

At my company we have over 5000 mailboxes. We currently have a older VBScript that runs on a daily basis that logs onto each mailbox, checks the total size of the mailbox, compares it to a hardcoded "limit" then sends the user an e-mail if they are getting close to full letting them know our companies mailbox policies and how to get help. I know Exchange 2003 (native) that we have has a capability similar to this, but you are unable to edit the message that they recieve so we can not use it... Exchange's message specifically tells people to use PST files which are against company policy. This program takes roughly 4-6 hours a day to run... its rather slow.

I've been tasked with updating this program... currently it will not run in a WindowsXP environment is is running on a legacy Windows2000 box.

I have been searching for quite some time and could not find an answer. Is there a way, useing C# which is my company standard, for me to get the current mailbox size of a user? I can easily pull their limits using DirectoryServices, but I just cant break into getting their current size.

I can not install anything on our Exchange servers themselves, nor can I modify any Exchange DLL's to modify their message. We have a Exchange 2003 native environment with about 6 servers.
Avatar of MATTHEW_L
MATTHEW_L

I'm not a C# programmer at all so I can't help you there.

However, it is a shame that you cannot make 1 .dll modification.  Changing the native warning message actually isn't very difficult.  You could then run all of this straight through Exchange with no external applications or code.

Here is the article in case you are interested.  This .dll would have to be copied to each Exchange server, but would work nicley.  I have used this method in the past.

http://www.exchangeserver2003.com/articles/showarticle.asp?id=1148632910
Avatar of ALogvin

ASKER

It is a matter of support. If we change 1 little DLL, Microsoft will just blame every little flaw in Exchange on that. We pay a lot for our support contract with MS to have them just dump the problem because we modified their stuff. God forbid they not hard-code in things like this.
I agree 100%.

Good luck in your search.
Avatar of ALogvin

ASKER

Yah, I've read that one a few times. All VBS, nothing in .NET at all. I cant run this on an Exchange server either, due to the reasons stated above.
What about at the bottom, seemed like something in C#
Avatar of ALogvin

ASKER

Nope. WebDav = VBScript, Visual Basic, Visual C.  There is a link for ADO, but ADO has to be run on the Exchange Server, and there are no C# methods, only C++ and VBS.
ASKER CERTIFIED SOLUTION
Avatar of sppence
sppence

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I forgot to mention above - you don't have to run this from the Exchange server, but the user you run this as does have to have rights to read that information from WMI (an account that is an admin on your Exchange server should work).
Avatar of ALogvin

ASKER

I'm trying it now, and will let you know...
Avatar of ALogvin

ASKER

That looks like it will work. I have a test domain that I am a full admin in, and it worked great there. It wont work in my production domain, but the only difference is my rights, so im sure once i get that resolved it will work great there too.

Thanks!!!
Is there a way that this can be done for a specific mailbox on the exchange server? The code appears to be searching the entire exchange server and I only want to check a specific mailbox. I'm also getting permission denied which I am hoping would go away if it was specific to the box that I care about (I do have permission to that). The credentials on the email box are not he same as the admin account on the server that this would run on so I may also need to be able to pass a specific username and passoword. Is this possible? Please let me know.