HighTechTalks DotNet Forums  

get Mailbox usage using WMI without Admin rights

Dotnet General Discussions microsoft.public.dotnet.general


Discuss get Mailbox usage using WMI without Admin rights in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
garks
 
Posts: n/a

Default get Mailbox usage using WMI without Admin rights - 11-20-2007 , 01:53 AM






I am using Exchange 2003(Exchange Hosting), C#.

I am trying to get Mailbox usage using WMI

But I follows the coding below, still cannot get the Mailbox usage.
Even though, I predefined the username and password.
Often gets "Access denied" while running the code.
I have tried to add the user to the \root\MicrosoftExchangeV2, and the
delegate control, but still cannot.
Is there anything I missing to add?
Or other methods that can access the mailbox usage?
Thanks in advanced

System.Management.ConnectionOptions objconn = new
System.Management.ConnectionOptions();
objconn.Impersonation =
System.Management.ImpersonationLevel.Impersonate;
objconn.EnablePrivileges = true;
string cServername = "servername";
System.Management.ManagementScope exmangescope = new
System.Management.ManagementScope(@"\\" + cServername + @"\root
\MicrosoftExchangeV2",objconn);
System.Management.ObjectQuery objquery = new
System.Management.ObjectQuery("SELECT * FROM Exchange_Mailbox");
System.Management.ManagementObjectSearcher objsearch = new
System.Management.ManagementObjectSearcher(exmange scope,objquery);
System.Management.ManagementObjectCollection queryCollection1 =
objsearch.Get();
string strDisplay;
foreach( System.Management.ManagementObject instmailbox in
queryCollection1 )
{
strDisplay = instmailbox["MailboxDisplayName"].ToString() + " " +
instmailbox["size"].ToString();
System.Console.WriteLine(strDisplay);
}

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.