Presentation is loading. Please wait.

Presentation is loading. Please wait.

MSG 334 Creating Exchange Administrative Scripting for the Non-Programmer Susan Hill Lead Programmer Writer Microsoft Corporation.

Similar presentations


Presentation on theme: "MSG 334 Creating Exchange Administrative Scripting for the Non-Programmer Susan Hill Lead Programmer Writer Microsoft Corporation."— Presentation transcript:

1 MSG 334 Creating Exchange Administrative Scripting for the Non-Programmer Susan Hill Lead Programmer Writer Microsoft Corporation

2 Agenda Overview of WMI Architecture Key Features Code Samples WMI in Exchange Server 2003

3 Windows Management Instrumentation (WMI) Microsoft’s implementation of WBEM Uniform access to management information Most Exchange 2003 monitoring is done through WMI

4 Overview Of WMI Based on Distributed Management Task Force Standards – CIM, WBEM Designed to reduce TCO of Windows Systems Extensible, object-oriented API Enables system-wide and application- level observation and control Consistent schema, queries, methods, events, and API

5 WMI Architecture WMIConsumers RegistryPerformanceCounters Other WMI ProvidersExchangeDirectory WindowsManagementInstrumentationService

6 How WMI Works in Exchange 2003 Server Consumer calls a WMI service Service authenticates the client Service passes call to the Exchange provider Provider queries the system for the information Provider returns information back to client

7 Key Features of WMI API accessible from multiple programming languages Remote administration Discoverability and navigation Query capability Event publication and subscription

8 Multiple Languages C++ Visual Basic JScript VBScript C# Perl …

9 Remote Administration No different than local administration Allows for enterprise management from a single computer

10 Discoverability and Navigation Enumerate Classes Tells you what objects are available Associations Define the relationships between classes Can be traversed

11 Query Capability Data is stored in a relational database WQL – SQL-style language Select * from ExchangeServerState where ServerState=3

12 Eventing Clients subscribe for events No internal event mechanism needed Events can be “keyed” off of: Instance Creation, Modification, Deletion

13 What’s New in WMI for Exchange 2003 20 new classes Message Tracking Queue Management Public Folder Management Mailbox MAPI Table Management Full list in the Exchange 2003 SDK on MSDN

14 Skeleton of a WMI program Get the WMI locator object Gain the root interface microsoftexchangev2 Query the provider Can use WSQL Interpret your results

15 VBS – Public Folder Names Set oLocator = CreateObject("WbemScripting.SWbemLocator") Set oServices = oLocator.connectServer("localhost", "root\microsoftexchangev2") Set oPFs = oServices.ExecQuery("select * from exchange_publicfolder”) For each oPF in oPFs WScript.Echo(oPF.name) Next

16 VBS – Create Public Folder Set oLocator = CreateObject("WbemScripting.SWbemLocator") Set oServices = oLocator.connectServer("localhost", "root\microsoftexchangev2") 'get the mapi folder tree set oTLHs = oServices.ExecQuery("select * from exchange_foldertree where mapifoldertree = true") for each oTLH in oTLHs 'there is only one mapi TLH szRootFolderUrl = oTLH.RootFolderUrl next 'create a public folder under the mapi folder tree Set oPF = oServices.Get("Exchange_PublicFolder").SpawnInstance_() oPF.Name = "WMI Public Folder" oPF.ParentFriendlyUrl = szRootFolderUrl oPF.Put_ wscript.echo("done.")

17 VBS – Mailbox Table Set oLocator = CreateObject("WbemScripting.SWbemLocator") Set oServices = oLocator.connectServer("localhost", "root\microsoftexchangev2") set oLogins = oServices.ExecQuery("select * from Exchange_Logon") for each oLogin in oLogins WScript.Echo(oLogin.LoggedOnUserAccount & " " & oLogin.ClientVersion) Next wscript.echo("done.")

18 VBS Programs Calling WMI demo demo

19 JScript – Message Tracking var oLocator = new ActiveXObject("WbemScripting.SWbemLocator"); var oServices = oLocator.connectServer("", "root\\microsoftexchangev2"); var szQuery = "select * from exchange_messagetrackingentry"; var e = new Enumerator(oServices.ExecQuery(szQuery)); var oMT = e.item(); var e = new Enumerator(oMT.Properties_); for (; !e.atEnd(); e.moveNext()) WScript.Echo (e.item().Name + " = " + e.item().Value);

20 JScript Program Calling WMI demo demo

21 C# Get Exchange DC public class WMICommon { public WMICommon() {} ~WMICommon() {} public string GetDC() { ManagementObjectSearcher searcher = new ManagementObjectSearcher(); string DCName = ""; ManagementScope scope = new ManagementScope("root\\microsoftexchangev2"); System.Management.ObjectQuery query = new System.Management.ObjectQuery("select * from Exchange_DSAccessDC whereType = 0"); searcher.Scope = scope; searcher.Query = query; foreach (ManagementObject configDC in searcher.Get()) { DCName = configDC["Name"].ToString(); } searcher.Dispose(); } return DCName;

22 C# Program Calling WMI demo demo

23 Additional Information Good WMI Intro Article http://msdn.microsoft.com/library/techart/mn gwmi.htm Exchange Server 2003 WMI Exchange Server 2003 SDK Documentation http://msdn.microsoft.com/exchange

24 Ask The Experts Get Your Questions Answered 11:00 Friday morning

25 Community Resources http://www.microsoft.com/communities/default.mspx Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx

26 Suggested Reading And Resources The tools you need to put technology to work! TITLE Available Microsoft® Exchange Server 2003 Administrator's Companion: 0-7356-1979-4 9/24/03 Active Directory® for Microsoft® Windows® Server 2003 Technical Reference: 0-7356-1577-2 Today Microsoft Press books are 20% off at the TechEd Bookstore Also buy any TWO Microsoft Press books and get a FREE T-Shirt

27 evaluations evaluations

28 © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.


Download ppt "MSG 334 Creating Exchange Administrative Scripting for the Non-Programmer Susan Hill Lead Programmer Writer Microsoft Corporation."

Similar presentations


Ads by Google