MSG 334 Creating Exchange Administrative Scripting for the
- Slides: 28
MSG 334 Creating Exchange Administrative Scripting for the Non-Programmer Susan Hill Lead Programmer Writer Microsoft Corporation
Agenda Overview of WMI Architecture Key Features Code Samples WMI in Exchange Server 2003
Windows Management Instrumentation (WMI) Microsoft’s implementation of WBEM Uniform access to management information Most Exchange 2003 monitoring is done through WMI
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 applicationlevel observation and control Consistent schema, queries, methods, events, and API
WMI Architecture WMI Consumers Windows Management Instrumentation Service Registry Performance Counters Exchange Other WMI Providers Directory
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
Key Features of WMI API accessible from multiple programming languages Remote administration Discoverability and navigation Query capability Event publication and subscription
Multiple Languages C++ Visual Basic JScript VBScript C# Perl …
Remote Administration No different than local administration Allows for enterprise management from a single computer
Discoverability and Navigation Enumerate Classes Tells you what objects are available Associations Define the relationships between classes Can be traversed
Query Capability Data is stored in a relational database WQL – SQL-style language Select * from Exchange. Server. State where Server. State=3
Eventing Clients subscribe for events No internal event mechanism needed Events can be “keyed” off of: Instance Creation, Modification, Deletion
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
Skeleton of a WMI program Get the WMI locator object Gain the root interface microsoftexchangev 2 Query the provider Can use WSQL Interpret your results
VBS – Public Folder Names Set o. Locator = Create. Object("Wbem. Scripting. SWbem. Locator") Set o. Services = o. Locator. connect. Server("localhost", "rootmicrosoftexchangev 2") Set o. PFs = o. Services. Exec. Query("select * from exchange_publicfolder”) For each o. PF in o. PFs WScript. Echo(o. PF. name) Next
VBS – Create Public Folder Set o. Locator = Create. Object("Wbem. Scripting. SWbem. Locator") Set o. Services = o. Locator. connect. Server("localhost", "rootmicrosoftexchangev 2") 'get the mapi folder tree set o. TLHs = o. Services. Exec. Query("select * from exchange_foldertree where mapifoldertree = true") for each o. TLH in o. TLHs 'there is only one mapi TLH sz. Root. Folder. Url = o. TLH. Root. Folder. Url next 'create a public folder under the mapi folder tree Set o. PF = o. Services. Get("Exchange_Public. Folder"). Spawn. Instance_() o. PF. Name = "WMI Public Folder" o. PF. Parent. Friendly. Url = sz. Root. Folder. Url o. PF. Put_ wscript. echo("done. ")
VBS – Mailbox Table Set o. Locator = Create. Object("Wbem. Scripting. SWbem. Locator") Set o. Services = o. Locator. connect. Server("localhost", "rootmicrosoftexchangev 2") set o. Logins = o. Services. Exec. Query("select * from Exchange_Logon") for each o. Login in o. Logins WScript. Echo(o. Login. Logged. On. User. Account & " " & o. Login. Client. Version) Next wscript. echo("done. ")
demo VBS Programs Calling WMI
JScript – Message Tracking var o. Locator = new Active. XObject("Wbem. Scripting. SWbem. Locator"); var o. Services = o. Locator. connect. Server("", "root\microsoftexchangev 2"); var sz. Query = "select * from exchange_messagetrackingentry"; var e = new Enumerator(o. Services. Exec. Query(sz. Query)); var o. MT = e. item(); var e = new Enumerator(o. MT. Properties_); for (; !e. at. End(); e. move. Next()) WScript. Echo (e. item(). Name + " = " + e. item(). Value);
demo JScript Program Calling WMI
C# Get Exchange DC public class WMICommon { public WMICommon() {} ~WMICommon() {} public string Get. DC() { Management. Object. Searcher searcher = new Management. Object. Searcher(); string DCName = ""; Management. Scope scope = new Management. Scope("root\microsoftexchangev 2"); System. Management. Object. Query query = new System. Management. Object. Query("select * from Exchange_DSAccess. DC where. Type = 0"); searcher. Scope = scope; searcher. Query = query; foreach (Management. Object config. DC in searcher. Get()) { DCName = config. DC["Name"]. To. String(); } searcher. Dispose(); } return DCName;
demo C# Program Calling WMI
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
Ask The Experts Get Your Questions Answered 11: 00 Friday morning
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
Suggested Reading And Resources The tools you need to put technology to work! TITLE Microsoft® Exchange Server 2003 Administrator's Companion: 0 -7356 -1979 -4 Active Directory® for Microsoft® Windows® Server 2003 Technical Reference: 0 -7356 -1577 -2 Available 9/24/03 Today Microsoft Press books are 20% off at the Tech. Ed Bookstore Also buy any TWO Microsoft Press books and get a FREE T-Shirt
evaluations
© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.
- Iat 334
- Arkansas development finance authority
- Ceng 334
- 334.edb. hkedcity. net/curriculum
- Iat 334
- Love story 334
- Ceng 334
- Learnability flexibility robustness
- Gas exchange key events in gas exchange
- Real exchange rate vs nominal exchange rate
- Voluntary exchange
- Lectio msg
- Psalm 121 msg
- Msg-3 maintenance program
- Matthew 5:13-16 msg
- Exodus 3:1-15
- Msg timeline
- Msg pesticide
- 2 peter 3 message
- Ad msg wnd
- Msg foundation case study
- Mhelpdesk msg
- Eva msg
- Ephesians 2 19 22
- Matthew 11 28 message
- John 2:111
- Msg fire
- Jeremiah 12:1-5
- Colossians 3:1-2 msg