Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ConnectionOptions conn = new ConnectionOptions();
- conn.Impersonation = ImpersonationLevel.Impersonate;
- conn.Authentication = AuthenticationLevel.Default;
- // Create a management scrope into the Exchange WMI namespace
- exmangescope =
- new System.Management.ManagementScope(@"\.RootMicrosoftExchangeV2");
- // Create a query to get the data from the Exchange WMI //List
- System.Management.ObjectQuery objquery =
- new System.Management.ObjectQuery("Select * FROM Exchange_Queue");
- // Retrieves a collection of management objects based on the query.
- System.Management.ManagementObjectSearcher objsearch =
- new System.Management.ManagementObjectSearcher(exmangescope, objquery);
- System.Management.ManagementObjectCollection queryCollection1 = null;
- // Invokes the WMI query and returns the resulting collection.
- try {
- queryCollection1 = objsearch.Get();
- } catch (System.Runtime.InteropServices.COMException comEx) {
- log4.Debug("ExchangeQueue 2003 receiving queues", comEx);
- throw comEx;
- }
- // Loop through each item in the collection
- log4.Debug( "QueueCount:" + queryCollection1.Count );
- foreach (System.Management.ManagementObject instmailbox in queryCollection1) { do Stuff}
Add Comment
Please, Sign In to add comment