<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Windows Management Infrastructure Blog</title><link>http://blogs.msdn.com/b/wmi/</link><description>Managing your IT infrastructure remotely, securely, reliably and efficiently</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Introducing new Management Infrastructure (MI) API</title><link>http://blogs.msdn.com/b/wmi/archive/2013/05/16/introducing-new-management-infrastructure-mi-api.aspx</link><pubDate>Thu, 16 May 2013 16:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10419367</guid><dc:creator>Osama Sajid [MSFT]</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10419367</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2013/05/16/introducing-new-management-infrastructure-mi-api.aspx#comments</comments><description>&lt;p&gt;In Windows 8/Windows server 2012 we introduced new Management Infrastructure (MI) API for writing WMI provider and client applications. This blog post will explain our goals for "Improving developer Experience"&amp;nbsp; and WHY&amp;nbsp; we did a new API for client and provider, instead of updating existing WMI API.&lt;/p&gt;
&lt;p&gt;We will continue to cover &amp;ldquo;HOW&amp;rdquo; to write providers and client applications using the new API in the blog series started by Haowei.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First a bit of recap:&lt;/p&gt;
&lt;p&gt;Last year in March we had a blog post from Jeffrey and Wojtek explaining the big picture of Standards Based Management in Windows Server 2012 and Window 8 . To recap, our goal for WMI and WinRM in Windows 8 was the following&lt;/p&gt;
&lt;p&gt;* Dramatically reduce the effort required to write WMI providers and standards-based management tools&lt;/p&gt;
&lt;p&gt;* Update our code to comply with the latest DMTF standards&lt;/p&gt;
&lt;p&gt;* Tightly integrate WMI, WinRM and Windows PowerShell&lt;/p&gt;
&lt;p&gt;* Provide a clear and compelling value proposition for everyone to use standards based management on Windows or any other platform.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;WMI was introduced way back during the days on Windows NT ; yes &amp;ndash; and it just seems like yesterday but a lot of water has flown under the bridge. Things were changing for server - we are now best Cloud OS, and manageability is one of our key differentiators ( instead of some side thought as it used to be)&lt;/p&gt;
&lt;p&gt;In the early days of Windows 8 planning, we had detailed discussions with partners and customers. Few things popped up early on&lt;/p&gt;
&lt;p&gt;1. Writing WMI providers and client applications is complex. There is a learning curve and it requires knowledge of underlying infrastructure (COM, complex ref-counting , WMI engine complexities and so on)&lt;/p&gt;
&lt;p&gt;2. Our infrastructure was not fully aligned with latest DMTF standards.&lt;/p&gt;
&lt;p&gt;3. Last but not the least, some partners were not clear if they should write WMI providers or PowerShell cmdlets (We said both, and the answer was "come on - that is a lot of duplication")&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This was great feedback. In order to meet the goals for Windows server to be the best cloud OS and meet our commitment for standards based management, we made it a goal to&lt;strong&gt; "Improve developer experience"&lt;/strong&gt;. This can be explained as following..&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Simplify provider development process&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Hide the complexity of underlying infrastructure.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; Developer should focus 100% on business logic.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Streamline end to end process (design, develop, deploy, test) -&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; Generate strongly typed skeleton code from MOF,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; Provide compile time checking and type safety.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; Reduce the amount of code required to be written.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; Simplify provider registration.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Simplify client development&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Hide the complexity of underlying infrastructure (including the protocol - DCOM or WinRM)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - Simple Sync and Async models for all standard operations. &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. Enable tight integration with PS.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Make WMI and CIM standard first class citizen in PowerShell&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Remove duplication of effort in writing WMI provider and PS Cmdlets.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4. Align with latest DMTF standards.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Make WsMan as the default protocol for client-server communication&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Update the schema to CIM schema 2.6&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you can see, it was simply not possible to achieve the goals outlined above with existing API. We needed a new "model" built from scratch - retrofitting and old model was not going to get us where we wanted to go.&lt;/p&gt;
&lt;p&gt;We introduced new &amp;ldquo;Management Infrastructure API&amp;rdquo; or MI API&amp;nbsp; for writing providers and client. This is going to be the API going forward - although old API is still supported, it will be in maintenance mode. All our future development effort will go towards the new API.&lt;/p&gt;
&lt;p&gt;By the end of Windows 8 development cycle &amp;ndash; we were glad to see many-fold increase in adoption of WMI and WinRM. We changed the developer perception (inside Microsoft)&amp;nbsp; from &amp;ldquo;COM-plex to CIM-plified&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;To summarize, following were some of the highlights for Server 2012 release last year.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Biggest increase in number on providers shipping in box in many releases&lt;/li&gt;
&lt;li&gt;&amp;nbsp;~1000 new cmdlets written using new MI provider API &amp;ndash; with WS-Man as the default remoting protocol.&lt;/li&gt;
&lt;li&gt;New Server Manager built using MI Client API - with WS-Man as the default remoting protocol.&lt;/li&gt;
&lt;li&gt;New CIM Cmdlets built using MI Client API - enabling PowerShell to manage non-Windows systems and devices. (This was covered in a previous blog: &lt;a class="internal-link view-post" href="http://blogs.msdn.com/b/wmi/archive/2012/08/29/introduction-to-cim-cmdlets.aspx"&gt;Introduction to CIM Cmdlets&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hope this blog explained the rationale and reason behind introducing a new model for writing providers and clients. Questions /comments are welcome - leave a note in the comments section below and we will get back to you.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Osama Sajid,&lt;/p&gt;
&lt;p&gt;Program Manager - Standards Based Management&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419367" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wmi/archive/tags/WMI/">WMI</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/WSMan/">WSMan</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/Powershell+Remoting/">Powershell Remoting</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/Standards+Based+Management/">Standards Based Management</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/CIM/">CIM</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/MI+API/">MI API</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/MI+Provider/">MI Provider</category></item><item><title>Implementing MI Provider (3) - Generate Code</title><link>http://blogs.msdn.com/b/wmi/archive/2013/05/11/implementing-mi-provider-3-generate-provider-skeleton.aspx</link><pubDate>Sat, 11 May 2013 21:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10417889</guid><dc:creator>Haowei Qin [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10417889</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2013/05/11/implementing-mi-provider-3-generate-provider-skeleton.aspx#comments</comments><description>&lt;p&gt;In blog &lt;a href="http://blogs.msdn.com/b/wmi/archive/2013/05/08/implementing-mi-provider-2.aspx"&gt;Implementing MI Provider (2)&lt;/a&gt;, we discussed schema definition of MI provider. Upon the schema ready, you&amp;nbsp;can run Convert-MofToProvider.exe tool to generate MI provider skeleton code.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Where&amp;nbsp;to install Convert-MofToProvider.exe tool?&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Install&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx"&gt;windows 8 SDK&lt;/a&gt; first, then you could find the tool under SDK installation directory. For example, the file path on my desktop is "C:\Program Files (x86)\Windows Kits\8.0\bin\x64\convert-moftoprovider.exe"&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Usage of Convert-MofToProvider.exe&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style="margin-right: auto; margin-left: auto;" border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="494"&gt;
&lt;p align="left"&gt;C:\Program Files (x86)\Windows Kits\8.0\bin\x64&amp;gt;convert-moftoprovider.exe /?&lt;/p&gt;
&lt;p align="left"&gt;Generates provider source code (C) from MOF class definitions.&lt;/p&gt;
&lt;p align="left"&gt;Usage:&amp;nbsp; Convert-MofToProvider.exe&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -MofFile &amp;lt;Mof files&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -ClassList &amp;lt;Class list&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -IncludePath &amp;lt;Path list&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -InputParameterSet &amp;lt;Parameter Filename&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Other options]&lt;/p&gt;
&lt;p align="left"&gt;-MofFile &amp;lt;Mof files&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Specifies list of mof files that contains the MOF definitions&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (or includes them), which are seperated by space.&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It must include any dependent MOF defintions as well (such as&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the CIM schema).&lt;/p&gt;
&lt;p align="left"&gt;-ClassList &amp;lt;Class list&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Specifies list of the names of the MOF classes to be generated.&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If no class specified, it will generate all classes.&lt;/p&gt;
&lt;p align="left"&gt;-IncludePath &amp;lt;Path list&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Specifies list of the directories, from which to search for included&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MOF files. If no include path specified, it will search current&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; directory by default.&lt;/p&gt;
&lt;p align="left"&gt;-InputParameterSet &amp;lt;Parameter Filename&amp;gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Specifies the parameter filename, which defines the input parameters.&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This option cannot be used with other options.&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Example: Convert-MofToProvider.exe -InputParameterSet param.txt&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Example of content for the parameter file,&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -MofFile a.mof&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -ClassList MSFT_A MSFT_B&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -IncludePath C:\stdmof&lt;/p&gt;
&lt;p align="left"&gt;[Other options]&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ......&lt;/p&gt;
&lt;p align="left"&gt;EXAMPLES:&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The following example generates a 'MSFT_ComputerSystem' class,&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; which is defined in schema.mof.&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Convert-MofToProvider -MofFile schema.mof -ClassList MSFT_ComputerSystem&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Convert-MofToProvider -MofFile schema.mof -ClassList MSFT_ComputerSystem&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -IncludePath C:\mof\cim222&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #000080; background-color: #ffffff;"&gt;&lt;span style="color: #000000;"&gt;&lt;strong&gt;NOTE&lt;/strong&gt;&lt;/span&gt;:&lt;/span&gt; [Other options] part was omitted, you can run "convert-moftoprovider.exe /?" to get the detail usage.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Generate code&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here are the steps to generate provider code skeleton for "process" provider, one of the sample provider&amp;nbsp;inside &lt;a href="http://code.msdn.microsoft.com/Management-Infrastructure-79fb414f"&gt;MI API sample&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First, setup up a working directory used to generate source code files, say C:\MIProvider&lt;/p&gt;
&lt;p&gt;Second,&amp;nbsp;make sure both sample.mof &amp;amp; MSFT_Qualifiers.mof present under working directory,&amp;nbsp;you can copy both files from &lt;a href="http://code.msdn.microsoft.com/Management-Infrastructure-79fb414f"&gt;MI API sample&lt;/a&gt;&amp;nbsp;to C:\MIProvider&lt;/p&gt;
&lt;p&gt;Third, download DMTF standard schema, which is a zip file contains list of standard mof files. Say &lt;a href="http://dmtf.org/standards/cim/cim_schema_v2260"&gt;CIM Schema 2.26.0&lt;/a&gt;, unzip the standard schema to a directory, say C:\DMTF2260&lt;/p&gt;
&lt;p&gt;Finally, run the following command line from an elevated command prompt console (cmd.exe)&lt;/p&gt;
&lt;pre class="scroll"&gt;&lt;code class="cplusplus"&gt;Convert-moftoprovider.exe -MofFile C:\MIProvider\sample.mof -ClassList MSFT_WindowsProcess MSFT_WindowsServiceProcess -IncludePath C:\DMTF2260 C:\MIProvider -ExtraClass Cim_Error -OutPath C:\MIProvider -SkipLocalize &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This command will,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;- use the MOF file called sample.Mof that in the folder C:\MIProvider&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;- use the CIM 2.26 schema located in the folder identified by C:\DMTF2260&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;- use MSFT_Qualifiers.MOF located in the folder identified by&amp;nbsp;C:\MIProvider&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;- generate skeleton code for the 2 classes following -Classlist&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;- include generated schema &amp;amp; types for the Cim_Error class&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;- place all output in the folder identified by the -OutPath parameter, i.e., C:\MIProvider&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;- skip the generation of resource IDs used for localization&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; - Generated provider will implement 2 classes, MSFT_WindowsProcess and MSFT_WindowsServiceProcess.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, the command line generates provider contains schema definition of parent classes and one extra class CIM_Error. Generated code files can be found under C:\MIProvider.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To better understand the generated files and its content, Figure 3.1 shows generated files' list for any MI provider.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21/0216.Figure3.1.jpg"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21/0216.Figure3.1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;strong&gt;Figure 3.1 Generated Files&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;While Strings.rc is optional , if &lt;strong&gt;-SkipLocalize&lt;/strong&gt; option was specified, then Strings.rc will not be generated. &amp;lt;class name&amp;gt;.h and &amp;lt;class name&amp;gt;.c are generated for all involved classes for MI Provider. Take above command line for example, it is going to generate following classes specific files,&lt;/p&gt;
&lt;pre class="scroll"&gt;&lt;code class="cplusplus"&gt;&lt;br /&gt; CIM_ConcreteJob.h&lt;br /&gt; CIM_EnabledLogicalElement.h&lt;br /&gt; CIM_Error.h&lt;br /&gt; CIM_Job.h&lt;br /&gt; CIM_LogicalElement.h&lt;br /&gt; CIM_ManagedElement.h&lt;br /&gt; CIM_ManagedSystemElement.h&lt;br /&gt; CIM_Process.h&lt;br /&gt; CIM_Service.h&lt;br /&gt; CIM_ServiceProcess.h&lt;br /&gt; MSFT_WindowsProcess.h&lt;br /&gt; MSFT_WindowsServiceProcess.h&lt;br /&gt; &lt;br /&gt; MSFT_WindowsProcess.c&lt;br /&gt; MSFT_WindowsServiceProcess.c&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Basically,&amp;nbsp;&amp;lt;class name&amp;gt;.c files&amp;nbsp;are only generated for the class name specified with -ClassList option, while &amp;lt;class name&amp;gt;.h files are generated for all class names specified with -ClassList option, -ExtraClass option, and all of their ancestor classes.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next&amp;nbsp;blog will&amp;nbsp;discuss the content of each generated file and its purpose. Thanks.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Haowei Qin&lt;/p&gt;
&lt;p&gt;Senior SDE&lt;/p&gt;
&lt;p&gt;Standards Based Management&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10417889" width="1" height="1"&gt;</description></item><item><title>Implementing MI Provider (2) - Define Schema</title><link>http://blogs.msdn.com/b/wmi/archive/2013/05/08/implementing-mi-provider-2.aspx</link><pubDate>Thu, 09 May 2013 05:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10417227</guid><dc:creator>Haowei Qin [MSFT]</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10417227</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2013/05/08/implementing-mi-provider-2.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;Define Schema&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To implement a MI provider, the first step is to model the management data, i.e., to define the schema of data. The schema has to be defined in &lt;a href="http://www.dmtf.org/education/mof"&gt;DMTF's Managed Object Format&lt;/a&gt; (MOF), which is very similar to &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa390351(v=vs.85).aspx"&gt;WMI MOF format&lt;/a&gt; except&amp;nbsp;partial&amp;nbsp;syntax of WMI MOF is not compliant with DMTF MOF.&lt;/p&gt;
&lt;p&gt;Definition of MOF file can be found at &lt;a href="http://www.dmtf.org/education/mof"&gt;http://www.dmtf.org/education/mof&lt;/a&gt;. Following is the copy of the definition from the page, &amp;ldquo;A MOF file can be encoded in either Unicode or UTF-8 format. MOF files are text files that contains definitions of classes and instances using the Managed Object Format (MOF) language. They can be edited using your favorite text editor or tool of choice.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;For MI provider, the MOF file defines only&amp;nbsp;classes that modeling the underline management objects. One class maps to one category of management objects, for example &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394372(v=vs.85).aspx"&gt;Win32_Process&lt;/a&gt; class was defined to manage processes that running on Windows OS.&lt;/p&gt;
&lt;p&gt;As described in &lt;a href="http://blogs.msdn.com/b/wmi/archive/2013/05/08/implementing-mi-provider-1.aspx"&gt;Implementing MI Provider (1)&lt;/a&gt;, there are 3 categories of providers, instance provider, association provider and indication provider. The type of provider actually refers to the type of class that being implemented, while the type of class depends on the class qualifier. Following are MOF examples for the 3 typical classes,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="scroll"&gt;&lt;code class="cplusplus"&gt;class MSFT_WindowsProcess : CIM_Process&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt; &amp;hellip;&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p align="center"&gt;&lt;strong&gt;MOF Example 2.0: (normal) Class&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;&amp;nbsp;
&lt;pre class="scroll"&gt;&lt;code class="cplusplus"&gt;[Association]&lt;br /&gt; class MSFT_WindowsServiceProcess&lt;br /&gt; {&lt;br /&gt; &lt;br /&gt; &amp;hellip;&lt;br /&gt; &lt;br /&gt; }&lt;br /&gt; &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p align="center"&gt;&lt;strong&gt;MOF Example 2.1: Association Class&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;&amp;nbsp;
&lt;pre class="scroll"&gt;&lt;code class="cplusplus"&gt;[Indicaiton]&lt;br /&gt; &lt;br /&gt; class MSFT_WindowsServiceStopped&lt;br /&gt; &lt;br /&gt; {&lt;br /&gt; &lt;br /&gt; &amp;hellip;&lt;br /&gt; &lt;br /&gt; }&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p align="center"&gt;&lt;strong&gt;MOF Example 2.2: Indication Class&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Schema Sample&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;An MI provider could implement one or more of above type&amp;rsquo;s classes. Be default those classes have fixed number of operations, generally, a (normal) class could have enumerate instance, get instance, delete instance, modify instance, and create instance; an association class could have assoicators of instance and references of instance operation; and an indication class could have enable indication, subscribe, unsubscribe, disable indication operations. Of course, a (normal) class could also have arbitrary number of methods defined, one method maps to one operation. Details will be discussed in the following blog Implementing MI Provider (3).&lt;/p&gt;
&lt;p&gt;To understand how to define classes that derives from standard class, following table&amp;nbsp;pastes the MOF file from &lt;a href="http://code.msdn.microsoft.com/Management-Infrastructure-79fb414f"&gt;Windows 8 SDK MIAPI Sample&lt;/a&gt;, it contains (normal) class, association class, and indication classes,&lt;/p&gt;
&lt;p&gt;(1) &lt;strong&gt;MSFT_WindowsProcess&lt;/strong&gt; derives from CIM_Process (CIM standard class), which models the process objects which is running on Windows Operating System. It is a (&lt;strong&gt;normal&lt;/strong&gt;) class.&lt;/p&gt;
&lt;p&gt;(2) &lt;strong&gt;MSFT_WindowsService&lt;/strong&gt; derives from CIM_Service (CIM standard class), which models the win32 services objects configured on Windows Operating System. &amp;nbsp;It is a (&lt;strong&gt;normal&lt;/strong&gt;) class.&lt;/p&gt;
&lt;p&gt;(3) &lt;strong&gt;MSFT_WindowsServiceManager&lt;/strong&gt; defines only an static method, which&amp;nbsp;reads service objects and return to client via streaming approach. The "&lt;strong&gt;stream&lt;/strong&gt;" qualifier will be discussed in future blog.&lt;/p&gt;
&lt;p&gt;(4) &lt;strong&gt;MSFT_WindowsServiceProcess&lt;/strong&gt; derives from CIM_ServiceProcess (CIM standard class), which is an &lt;strong&gt;association&lt;/strong&gt; class. The "association" qualifier&amp;nbsp;is inherited from parent class "CIM_ServiceProcess".&lt;/p&gt;
&lt;p&gt;(5) &lt;strong&gt;MSFT_WindowsServiceStopped&lt;/strong&gt; derives from CIM_InstModification (CIM standard class), which is an &lt;strong&gt;indication&lt;/strong&gt; class. It produces indication(s) upon the stop of any running window service.&lt;/p&gt;
&lt;p&gt;(6) &lt;strong&gt;MSFT_WindowsServiceStarted&lt;/strong&gt; derives&amp;nbsp;from CIM_InstModification (CIM standard class), which is an &lt;strong&gt;indication&lt;/strong&gt; class. It produces indication(s) upon the start of any window service.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;table style="margin-right: auto; margin-left: auto;" border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top"&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;//&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// ANY KIND, EITHER EXPRESSED OR IMPLIED,&amp;nbsp;INCLUDING BUT NOT LIMITED TO&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// THE IMPLIED WARRANTIES OF MERCHANTABILITY&amp;nbsp;AND/OR FITNESS FOR A&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// PARTICULAR PURPOSE.&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;//&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// Copyright (c) Microsoft Corporation. All&amp;nbsp;rights reserved&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;//&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;#pragma include&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;("cim_schema_2.26.0.mof")&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;#pragma include&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;("MSFT_Qualifiers.mof")&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// MSFT_WindowsProcess class derives from&amp;nbsp;CIM_Process class,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// which defines the schema for the processes&amp;nbsp;running on windows OS.&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;[ClassVersion("1.0.0")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;class &lt;strong&gt;MSFT_WindowsProcess&lt;/strong&gt; : CIM_Process&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String&amp;nbsp;CommandLine;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; [Description("This instance method demonstrates modifying the "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; "and any other number to indicate an win32 error code.")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Uint32&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;SetPriority([In] uint32 Priority);&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[static,&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;Description("This static method demonstrates creating a process "&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; "by supplying commandline to start a new process."&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; "It will output the reference to the newly created process."&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; "The method returns an integer value of 0 if the process "&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; "was successfully created, and any other number to "&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; "indicate an win32 error code.")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;Create([In] string CommandLine, [Out] CIM_Process ref Process);&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;};&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// MSFT_WindowsService class derives from&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;CIM_Service class,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// which defines the schema for the services&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;present on windows OS.&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;[ClassVersion("1.0.0")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;class &lt;strong&gt;MSFT_WindowsService&lt;/strong&gt; : CIM_Service&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // To&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;implement methods defined in parent class,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // it is &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;mandatory to copy those methods definition&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // from&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;parent class and redefine in child class&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; uint32&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;StartService();&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;StopService();&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;};&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;[Description("This class demonstrates&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;designing a WMI class "&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;" having a static method to use the&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;feature of steam output parameter, "&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;"which allows provider to send output array&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;element one by one back to "&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;"client instead of sending the whole&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;array back at one time."),&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;ClassVersion("1.0.0")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;class &lt;strong&gt;MSFT_WindowsServiceManager&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// GetWindowsServices method reads list of&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;MSFT_WindowsService instances with specific status,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// value of 0 for stopped services, 1 for running&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;services, and other values for all services.&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;[static] uint32 GetWindowsServices(&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [in, ValueMap { "0",&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;"1", ".."}, Values {&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;"Running","Stopped", "All"}]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint32 status,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [out, stream, EmbeddedInstance("MSFT_WindowsService")]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; &amp;nbsp; string services[]);&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;};&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;//&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// MSFT_WindowsServiceProcess class derives from&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;CIM_ServiceProcess class,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// which associates present services instance&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;with running process instance on windows OS.&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;[ClassVersion("1.0.0")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;class &lt;strong&gt;MSFT_WindowsServiceProcess&lt;/strong&gt; :&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;CIM_ServiceProcess&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;};&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;//&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;MSFT_WindowsServiceStopped class derives from CIM_InstModification class,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// which presents the notification of a stopped&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;service on windows OS.&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;[ClassVersion("1.0.0")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;class &lt;strong&gt;MSFT_WindowsServiceStopped&lt;/strong&gt; : CIM_InstModification&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;};&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;//&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;MSFT_WindowsServiceStarted class derives from CIM_InstModification class,&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;// which presents the notification of a started&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;service on windows OS.&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;// &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;[ClassVersion("1.0.0")]&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;class &lt;strong&gt;MSFT_WindowsServiceStarted&lt;/strong&gt; :&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;CIM_InstModification&lt;/span&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;};&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p style="text-align: center;"&gt;&lt;strong&gt;MOF&amp;nbsp;of &lt;a href="http://code.msdn.microsoft.com/Management-Infrastructure-79fb414f"&gt;Windows 8 SDK MIAPI Sample&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For complete MOF syntax, please refer to &lt;a href="http://www.dmtf.org/sites/default/files/standards/documents/DSP0004_2.6.0_0.pdf"&gt;DSP0004 version 2.6.0&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Haowei Qin&lt;/p&gt;
&lt;p&gt;Senior SDE&lt;/p&gt;
&lt;p&gt;Standards Based Management&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10417227" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wmi/archive/tags/DMTF/">DMTF</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/MI+Provider/">MI Provider</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/MOF/">MOF</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/Association/">Association</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/Indication/">Indication</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/DAL/">DAL</category></item><item><title>Implementing MI Provider (1) - Overview</title><link>http://blogs.msdn.com/b/wmi/archive/2013/05/08/implementing-mi-provider-1.aspx</link><pubDate>Wed, 08 May 2013 18:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10417112</guid><dc:creator>Haowei Qin [MSFT]</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10417112</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2013/05/08/implementing-mi-provider-1.aspx#comments</comments><description>&lt;p class="paragraph"&gt;Blog &lt;a href="http://blogs.technet.com/b/windowsserver/archive/2012/03/30/standards-based-management-in-windows-server-8.aspx"&gt;Standards-based Management in Windows Server &amp;ldquo;8&amp;rdquo;&lt;/a&gt;&amp;nbsp;gives overview&amp;nbsp;of standard-based management and architecture of the new management stack introduced in Windows 8 and Windows Server 2012. &amp;ldquo;Implementing MI Provider&amp;rdquo; series blogs are about to discuss how to implement MI provider step by step, including a brief tutorial on implementing a MI provider; an introduction to MI API; preparations for writing a MI provider; defining schema; generating provider skeleton code; implementing MI provider skeleton; registering a MI provider; and debugging MI provider(s).&lt;/p&gt;
&lt;p class="paragraph"&gt;This blog is about to discuss the concept of MI provider; availability of MI API; and preparations for writing a MI provider.&lt;/p&gt;
&lt;p class="paragraph"&gt;&lt;strong&gt;What is MI Provider?&lt;/strong&gt;&lt;/p&gt;
&lt;p class="paragraph"&gt;Before introducing MI Provider, I assume you have the knowledge about &amp;ldquo;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394553(v=vs.85).aspx"&gt;what is WMI&lt;/a&gt;&amp;rdquo; and &amp;ldquo;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/cc512238(v=vs.85).aspx"&gt;how to write WMI provider&lt;/a&gt;&amp;rdquo;. Similar to a WMI provider, MI provider(s) are used to expose data and operations to client applications and/or administrators via CIMOM server, which is WMI on windows OS.&lt;/p&gt;
&lt;p class="paragraph"&gt;A MI provider implements MI provider interface, which is C based and compliant with &lt;a href="http://dmtf.org/standards/cim"&gt;CIM standard&lt;/a&gt;. A MI provider exposes both schema (CIM class) information of the manageable objects and operations against the manageable objects. Generally, MI provider can be divided into 3 categories, instance provider; association provider; and indication provider.&lt;/p&gt;
&lt;p class="paragraph"&gt;An instance MI provider supports &lt;strong&gt;&lt;em&gt;intrinsic&lt;/em&gt;&lt;/strong&gt; methods, including enumerate instance, get instance, create instance, delete instance and modify instance; and &lt;strong&gt;&lt;em&gt;extrinsic&lt;/em&gt;&lt;/strong&gt; methods, including instance method and static method.&lt;/p&gt;
&lt;p class="paragraph"&gt;An association MI provider is similar to &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ee309384(v=vs.85).aspx"&gt;WMI association provider&lt;/a&gt;, which is used to associate instances of different classes. Details will be discussed in the following blogs.&lt;/p&gt;
&lt;p class="paragraph"&gt;An indication MI provider is similar to &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc301317.aspx"&gt;WMI Event provider&lt;/a&gt;, which delivers notifications about the changes of manageable objects from server to client. A specific indication class provides notification when specific events occur. An indication provider may implements multiple indication classes. Details will be discussed in the following blogs.&lt;/p&gt;
&lt;p align="left"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="paragraph"&gt;&lt;strong&gt;Availability of MI provider API&lt;/strong&gt;&lt;/p&gt;
&lt;p class="paragraph"&gt;Windows 8 and Windows Server 2012 introduce a new set of management APIs, called the &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/hh404805(v=vs.85).aspx"&gt;Windows Management Infrastructure&lt;/a&gt; (MI) APIs. This includes &lt;strong&gt;&lt;em&gt;MI provider &lt;/em&gt;&lt;/strong&gt;C APIs, client C APIs, and client .Net APIs. These set of new APIs are more tightly aligned with the CIM standard that is the basis for WMI, and provide support for the standard WS-Man protocol via WinRM.&lt;/p&gt;
&lt;p class="paragraph"&gt;These new APIs will interoperate directly with existing Windows Management Instrumentation (WMI) clients and providers. An application written using the new client APIs work with pre-existing WMI providers as well as providers based on the new MI C APIs. Likewise, providers written using the new APIs can be called from client applications written using the older version of the WMI .Net and C APIs.&lt;/p&gt;
&lt;p class="paragraph"&gt;Table 1.0 contains list of terms that might be useful to understand the content of the blog.&lt;/p&gt;
&lt;table style="margin-right: auto; margin-left: auto;" border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="137"&gt;
&lt;p class="paragraph"&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="482"&gt;
&lt;p class="paragraph"&gt;&lt;strong&gt;Definition&lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="137"&gt;
&lt;p class="paragraph"&gt;CIM&amp;nbsp;Class&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="482"&gt;
&lt;p class="paragraph"&gt;A&amp;nbsp;schema that represents a managed resource type on server&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="137"&gt;
&lt;p class="paragraph"&gt;CIM&amp;nbsp;Instance&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="482"&gt;
&lt;p class="paragraph"&gt;A&amp;nbsp;snapshot representation of an instance of a CIM class on a CIMOM server&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="137"&gt;
&lt;p class="paragraph"&gt;CIM&amp;nbsp;Provider&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="482"&gt;
&lt;p class="paragraph"&gt;Provides&amp;nbsp;set of CIM standard operations of a CIM class&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="137"&gt;
&lt;p class="paragraph"&gt;CIMOM&amp;nbsp;server&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="482"&gt;
&lt;p class="paragraph"&gt;A&amp;nbsp;process which responds to the client CIOMI request to any managed resources&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="FigureTitle" style="text-align: center;"&gt;&lt;strong&gt;Table 1.0 Terminologies&lt;/strong&gt;&lt;/p&gt;
&lt;p class="paragraph"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="paragraph"&gt;&lt;strong&gt;MI provider development process&lt;/strong&gt;&lt;/p&gt;
&lt;p class="paragraph"&gt;Windows 8 and Windows Server 2012 introduce a new provider model, with code generation and provider registration tools, which works seamlessly with MI provider API.&lt;/p&gt;
&lt;p class="paragraph"&gt;A C based provider code skeleton can be generated from user-defined schema in the form of a MOF file, using the tool called Convert-MofToProvider.exe, which ships in the Windows 8 SDK.&lt;/p&gt;
&lt;p class="paragraph"&gt;Register-CimProvider.exe is a new provider registration tool, and ships with Windows 8 and Windows Server 2012, and is used to register a MI provider into WMI. These tools work only for providers based on the new APIs.&lt;/p&gt;
&lt;p class="paragraph"&gt;Figure 1.0 shows steps of writing a CIM provider, the remaining content of the blog serials follows exactly those steps.&lt;/p&gt;
&lt;p class="paragraph" style="text-align: center;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21/5481.devprocess.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21/5481.devprocess.png" alt="" width="275" height="482" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div&gt;
&lt;p class="FigureHolder" style="text-align: center;"&gt;&lt;strong&gt;Figure 1.0 MI provider development process&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p class="paragraph"&gt;Assume you have your MI provider ready, then, you may ask a question - how do I access the data and operations exposed by the CIM provider(s)? The short answer is "many ways". You could use MI C API, MI .Net API, and of course Powershell cmdlets.&lt;/p&gt;
&lt;p class="paragraph"&gt;&lt;strong&gt;Powershell Cmdlets&lt;/strong&gt;&lt;/p&gt;
&lt;p class="paragraph"&gt;There are two types of cmdlets introduced by windows 8 and windows server 2012, CIM-Based cmdlets and generic CIM cmdlets.&lt;/p&gt;
&lt;p class="paragraph"&gt;A &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/jj542520(v=vs.85).aspx"&gt;CIM-Based Cmdlet model&lt;/a&gt; was introduced to support creation of PowerShell cmdlets, which expose the data and the operations of any provider to PowerShell users. It introduces a new way to create cmdlets by using an XML file to describe the cmdlet functionality, and then importing the new module into PowerShell. This new way of writing cmdlets works with both new providers written using the MI APIs, and providers written using the older WMI APIs.&lt;/p&gt;
&lt;p class="paragraph"&gt;A set of generic cmdlets called &lt;a href="http://technet.microsoft.com/en-us/library/jj553783(v=wps.620).aspx"&gt;CIM Cmdlets&lt;/a&gt;, which are based on the MI client .Net API, and help to consume the data and operations from any new or existing providers.&lt;/p&gt;
&lt;p class="paragraph"&gt;In order to provide seamless Powershell Cmdlet experiences, a set of Powershell semantics specific provider APIs were introduced to allow MI provider to write verbose message to Powershell, update operation progress data, ask user confirmation for dangerous operations, etc. Those APIs will be discussed in following blogs.&lt;/p&gt;
&lt;p class="paragraph"&gt;To start writing a CIM provider, following are the preparation steps.&lt;/p&gt;
&lt;p class="paragraph"&gt;&lt;strong&gt;Preparation&lt;/strong&gt;&lt;/p&gt;
&lt;p class="paragraph"&gt;First of all, there are set of tools to help implementing and debugging a CIM provider. For each step of figure 1.0, there are some tools available.&lt;/p&gt;
&lt;p class="paragraph"&gt;(1)&amp;nbsp;&amp;nbsp;For schema defining, you can use &lt;a href="http://archive.msdn.microsoft.com/cimide/"&gt;CIM IDE&lt;/a&gt;. Of course, you can create the mof in any text editor.&lt;/p&gt;
&lt;p class="paragraph"&gt;(2)&amp;nbsp;&amp;nbsp;Convert-MofToProvider.exe is used to generating provider skeleton code, which is shipped as of &lt;a href="http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx"&gt;windows 8 SDK&lt;/a&gt;.&lt;/p&gt;
&lt;p class="paragraph"&gt;(3)&amp;nbsp;&amp;nbsp;You need visual studio 2012 and &lt;a href="http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx"&gt;windows 8 SDK&lt;/a&gt;&amp;nbsp;to implement and build the provider &lt;a href="http://code.msdn.microsoft.com/Management-Infrastructure-79fb414f"&gt;MI API sample&lt;/a&gt;, which&amp;nbsp;contains a set of MI provider samples.&lt;/p&gt;
&lt;p class="paragraph"&gt;(4)&amp;nbsp;&amp;nbsp;Register-CimProvider.exe is the tool used for registering CIM provider(s) into WMI.&lt;/p&gt;
&lt;p class="paragraph"&gt;(5)&amp;nbsp;&amp;nbsp;For debugging a provider, you can use either visual studio 2012 or &lt;a href="http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx"&gt;Windbg&lt;/a&gt;.&lt;/p&gt;
&lt;p class="paragraph"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="paragraph"&gt;To setup a development environment, you may need to,&lt;/p&gt;
&lt;p class="paragraph"&gt;(1)&amp;nbsp;Install visual studio 2012&lt;/p&gt;
&lt;p class="paragraph"&gt;(2)&amp;nbsp;Install &lt;a href="http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx"&gt;windows 8 SDK&lt;/a&gt;, which contains set of tools listed above; MI API header file as well as lib file, called mi.h and mi.lib respectively; and mi.net api.&lt;/p&gt;
&lt;p class="paragraph"&gt;(3)&amp;nbsp;Install &lt;a href="http://code.msdn.microsoft.com/Management-Infrastructure-79fb414f"&gt;MI API sample&lt;/a&gt;, which contains several MI provider samples.&lt;/p&gt;
&lt;p&gt;(4)&amp;nbsp;If your class derives from DMTF standard class, then you may have to download the CIM standard schema from &lt;a href="http://dmtf.org/standards/cim"&gt;DMTF website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Haowei Qin&amp;nbsp;[MSFT]&lt;br /&gt;Senior SDE&lt;br /&gt;Standards Based Management&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10417112" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wmi/archive/tags/MI+API/">MI API</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/MI+Provider/">MI Provider</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/DAL/">DAL</category></item><item><title>How to Implement a Profile Registration Provider</title><link>http://blogs.msdn.com/b/wmi/archive/2013/03/25/how-to-implement-a-profile-registration-provider.aspx</link><pubDate>Mon, 25 Mar 2013 22:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10405245</guid><dc:creator>SBM Team [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10405245</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2013/03/25/how-to-implement-a-profile-registration-provider.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The DMTF standard uses profiles to perform namespace&lt;br /&gt;discovery. As an implementer of a&lt;br /&gt;profile, you need to register a profile object that points to the&lt;br /&gt;namespace of the implementing class. The profile object must be implemented under the root/interop namespace.&lt;em&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Profile Registration MOF Files&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dmtf.org/sites/default/files/standards/documents/DSP1033_1.0.0.pdf"&gt;http://www.dmtf.org/sites/default/files/standards/documents/DSP1033_1.0.0.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The above document fully describes the necessary profile&lt;br /&gt;classes that the provider needs to implement.&lt;/p&gt;
&lt;p&gt;For example, in order to implement the Ethernet switch&lt;br /&gt;profile, you need to first&lt;br /&gt;create the CIM_EthernetSwitchProfile class that derives from&lt;br /&gt;CIM_RegisteredProfile as well as the CIM_EthernetSwitchConformsToProfile class&lt;br /&gt;that derives from CIM_ElementConformsToProfile. The second class is an&lt;br /&gt;association that provides the concrete implementation of the Ethernet switch&lt;br /&gt;class (e.g. CIM_ComputerSystem).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Profile Registration &lt;/strong&gt;&lt;strong&gt;Provider Implementation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Once the MOF files are created, you need to generate a provider skeleton. This can be done using&lt;br /&gt;the following command:&lt;/p&gt;
&lt;p&gt;Convert-MofToProvider &amp;ndash;MofFile &amp;lt;Mof file location&amp;gt;&lt;br /&gt;-ClassList CIM_EthernetSwitchProfile CIM_EthernetSwitchProfileConformsToProfile&lt;/p&gt;
&lt;p&gt;After creating the provider skeleton, you need to implement&lt;br /&gt;EnumerateInstances by returning a static instance of the&lt;br /&gt;CIM_EthernetSwitchProfile class. Here&lt;br /&gt;is a sample implementation of EnumerateInstances:&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt;**==============================================================================&lt;br /&gt;**&lt;br /&gt;** Open Management Infrastructure (OMI)&lt;br /&gt;**&lt;br /&gt;** Copyright (c) Microsoft Corporation&lt;br /&gt;** &lt;br /&gt;** Licensed under the Apache License, Version 2.0 (the "License"); you may not &lt;br /&gt;** use this file except in compliance with the License. You may obtain a copy &lt;br /&gt;** of the License at &lt;br /&gt;**&lt;br /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.apache.org/licenses/LICENSE-2.0"&gt;http://www.apache.org/licenses/LICENSE-2.0&lt;/a&gt; &lt;br /&gt;**&lt;br /&gt;** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY&lt;br /&gt;** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED &lt;br /&gt;** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, &lt;br /&gt;** MERCHANTABLITY OR NON-INFRINGEMENT. &lt;br /&gt;**&lt;br /&gt;** See the Apache 2 License for the specific language governing permissions &lt;br /&gt;** and limitations under the License.&lt;br /&gt;**&lt;br /&gt;**==============================================================================&lt;/p&gt;
&lt;p&gt;void MI_CALL MSFT_EthernetSwitchProfile_EnumerateInstances(&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_ MSFT_EthernetSwitchProfile_Self* self,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_ MI_Context* context,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_z_ const MI_Char* nameSpace,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_z_ const MI_Char* className,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_ const MI_PropertySet* propertySet,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_ MI_Boolean keysOnly,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_ const MI_Filter* filter)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;CIM_RegisteredProfile staticEthernetSwitchProfile;&lt;/p&gt;
&lt;p&gt;CIM_RegisteredProfile_Construct(&amp;amp;staticEthernetSwitchProfile,&lt;br /&gt;context);&lt;/p&gt;
&lt;p&gt;CIM_RegisteredProfile_Set_InstanceID(&amp;amp;staticEthernetSwitchProfile,&lt;br /&gt;MI_T("EthernetSwitchProfile"));&lt;/p&gt;
&lt;p&gt;CIM_RegisteredProfile_Set_RegisteredName(&amp;amp;staticEthernetSwitchProfile,&lt;br /&gt;MI_T("Ethernet Switch Profile"));&lt;/p&gt;
&lt;p&gt;CIM_RegisteredProfile_Set_RegisteredOrganization(&amp;amp;staticEthernetSwitchProfile,&lt;br /&gt;1); // Other&lt;br /&gt;organization&lt;/p&gt;
&lt;p&gt;CIM_RegisteredProfile_Set_OtherRegisteredOrganization(&amp;amp;staticEthernetSwitchProfile,&lt;br /&gt;MI_T("Microsoft"));&lt;/p&gt;
&lt;p&gt;CIM_RegisteredProfile_Set_RegisteredVersion(&amp;amp;staticEthernetSwitchProfile,&lt;br /&gt;MI_T("1.0")); &lt;br /&gt;&lt;br /&gt;CIM_RegisteredProfile_Post(&amp;amp;staticEthernetSwitchProfile, context);&lt;/p&gt;
&lt;p&gt;MI_Context_PostResult(context, MI_RESULT_OK);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;You need to&lt;br /&gt;implement the EnumerateInstances method of CIM_EthernetSwitchConformsToProfile&lt;br /&gt;by returning the actual implementation of the Ethernet switch (e.g. CIM_ComputerSystem)&lt;br /&gt;as a CIM_ManagedElement. Here is a&lt;br /&gt;sample implementation of EnumerateInstances:&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt;**==============================================================================&lt;br /&gt;**&lt;br /&gt;** Open Management Infrastructure (OMI)&lt;br /&gt;**&lt;br /&gt;** Copyright (c) Microsoft Corporation&lt;br /&gt;** &lt;br /&gt;** Licensed under the Apache License, Version 2.0 (the "License"); you may not &lt;br /&gt;** use this file except in compliance with the License. You may obtain a copy &lt;br /&gt;** of the License at &lt;br /&gt;**&lt;br /&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.apache.org/licenses/LICENSE-2.0"&gt;http://www.apache.org/licenses/LICENSE-2.0&lt;/a&gt; &lt;br /&gt;**&lt;br /&gt;** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY&lt;br /&gt;** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED &lt;br /&gt;** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, &lt;br /&gt;** MERCHANTABLITY OR NON-INFRINGEMENT. &lt;br /&gt;**&lt;br /&gt;** See the Apache 2 License for the specific language governing permissions &lt;br /&gt;** and limitations under the License.&lt;br /&gt;**&lt;br /&gt;**==============================================================================&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;void MI_CALL MSFT_EthernetSwitchConformsToProfile_EnumerateInstances(&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_ MSFT_EthernetSwitchConformsToProfile_Self* self,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_ MI_Context* context,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_z_ const MI_Char* nameSpace,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_z_ const MI_Char* className,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_ const MI_PropertySet* propertySet,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_ MI_Boolean keysOnly,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _In_opt_ const MI_Filter* filter)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;MSFT_EthernetSwitchConformsToProfile element;&lt;br /&gt;&lt;br /&gt;CIM_ManagedElement computerSystem;&lt;/p&gt;
&lt;p&gt;CIM_ManagedElement_Construct(&amp;amp;computerSystem,&lt;br /&gt;context);&lt;/p&gt;
&lt;p&gt;CIM_ManagedElement_Set_InstanceID(&amp;amp;computerSystem,&lt;br /&gt;MI_T("ComputerSystem"));&lt;/p&gt;
&lt;p&gt;CIM_ManagedElement_Set_Caption(&amp;amp;computerSystem,&lt;br /&gt;MI_T("TOR Switch Computer System"));&lt;/p&gt;
&lt;p&gt;CIM_ManagedElement_Set_Description(&amp;amp;computerSystem,&lt;br /&gt;MI_T("Replace with concrete implementation"));&lt;/p&gt;
&lt;p&gt;MSFT_EthernetSwitchConformsToProfile_Construct(&amp;amp;element,&lt;br /&gt;context);&lt;/p&gt;
&lt;p&gt;MSFT_EthernetSwitchConformsToProfile_Set_ConformantStandard(&amp;amp;element,&lt;br /&gt;&amp;amp;staticEthernetSwitchProfile);&lt;/p&gt;
&lt;p&gt;MSFT_EthernetSwitchConformsToProfile_Set_ManagedElement(&amp;amp;element,&lt;br /&gt;&amp;amp;computerSystem);&lt;/p&gt;
&lt;p&gt;MSFT_EthernetSwitchConformsToProfile_Post(&amp;amp;element,&lt;br /&gt;context);&lt;/p&gt;
&lt;p&gt;MSFT_EthernetSwitchConformsToProfile_Destruct(&amp;amp;element);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;CIM_ManagedElement_Destruct(&amp;amp;computerSystem);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;MI_Context_PostResult(context, MI_RESULT_OK);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Provider Registration&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Multiple profiles&lt;br /&gt;should be combined into one single provider. The provider can be registered&lt;br /&gt;using the following command:&lt;/p&gt;
&lt;p&gt;Register-CimProvider ProfileProvider.dll&lt;/p&gt;
&lt;p&gt;James Wei&lt;br /&gt;[MSFT]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10405245" width="1" height="1"&gt;</description></item><item><title>Windows Management Framework 3.0 Compatibility Update</title><link>http://blogs.msdn.com/b/wmi/archive/2012/12/20/windows-management-framework-3-0-compatibility-update.aspx</link><pubDate>Thu, 20 Dec 2012 02:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10379628</guid><dc:creator>SBM Team [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10379628</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2012/12/20/windows-management-framework-3-0-compatibility-update.aspx#comments</comments><description>&lt;p&gt;We have an important update regarding WMF 3.0 ("Windows Management Framework") compatibility. Those who want to install WMF 3.0 to take advantage of all the great features this update provides can do so by installing the update from the &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=34595"&gt;Microsoft Download Center&lt;/a&gt;, after reading the known compatibility issues detailed in the blog post below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/powershell/archive/2012/12/20/windows-management-framework-3-0-compatibility-update.aspx"&gt;http://blogs.msdn.com/b/powershell/archive/2012/12/20/windows-management-framework-3-0-compatibility-update.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10379628" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wmi/archive/tags/WMI/">WMI</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/powershell/">powershell</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/Windows+Management+Framework/">Windows Management Framework</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/WMF/">WMF</category></item><item><title>WMI cheat sheet and link to MSDN documentation</title><link>http://blogs.msdn.com/b/wmi/archive/2012/10/28/wmi-cheat-sheet-and-link-to-msdn-documentation.aspx</link><pubDate>Sun, 28 Oct 2012 20:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10363468</guid><dc:creator>Osama Sajid [MSFT]</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10363468</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2012/10/28/wmi-cheat-sheet-and-link-to-msdn-documentation.aspx#comments</comments><description>&lt;p&gt;WMI team created a useful cheat sheet summarizing what's new in WMI. This is a great reference doc for developers. We are making them available through this blog post - as is.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The real documentation is still on MSDN (and it is being regularly updated). Cheat sheets are just a quick reference to get people started.&lt;/p&gt;
&lt;p&gt;Some other useful links&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;table style="width: 889px;" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="231" valign="top"&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/jj152383(v=vs.85).aspx"&gt;WMI &amp;ndash; MI API docs on MSDN&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="658" valign="top"&gt;
&lt;p&gt;MSDN location of the new WMI Management Infrastructure&amp;nbsp;&amp;nbsp; API documentation.&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="231" valign="top"&gt;
&lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Management-Infrastructure-79fb414f"&gt;SDK&lt;/a&gt;&amp;nbsp;Samples&lt;/p&gt;
&lt;/td&gt;
&lt;td width="658" valign="top"&gt;
&lt;p&gt;MI API Samples&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="231" valign="top"&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=34595"&gt;WMF 3.0&amp;nbsp;&amp;nbsp; download&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="658" valign="top"&gt;
&lt;p&gt;Download the Windows Management Framework. Contains WMI,&amp;nbsp;&amp;nbsp; WS-Man &amp;amp; PowerShell updates from Win8. Applies to WinSrv2008, 2008R2, and&amp;nbsp;&amp;nbsp; Win7.&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="231" valign="top"&gt;
&lt;p&gt;&lt;a href="http://archive.msdn.microsoft.com/cimide"&gt;CIM IDE&amp;nbsp; download&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="658" valign="top"&gt;
&lt;p&gt;CIM&amp;nbsp; IDE tool is a Visual Studio snap-in used to build WMI providers &amp;amp; CDXML.&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Thanks to Keith Bankston, lead WMI PM , for authoring this this cheat sheet and sharing with community.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Osama Sajid&lt;/p&gt;
&lt;p&gt;Program Manager&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10363468" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-36-34-68/WMI-CheatSheet-for-Developers.pdf" length="306268" type="application/pdf" /></item><item><title>PowerShell cmdlets invocation through Management ODATA using WCF client</title><link>http://blogs.msdn.com/b/wmi/archive/2012/09/10/powershell-cmdlets-invocation-through-management-odata-using-wcf-client.aspx</link><pubDate>Tue, 11 Sep 2012 00:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10348021</guid><dc:creator>Narine Mossikyan [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10348021</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2012/09/10/powershell-cmdlets-invocation-through-management-odata-using-wcf-client.aspx#comments</comments><description>&lt;p&gt;Management ODATA uses the Open Data Protocol (ODATA) to expose and consume data over the Web or Intranet. It is primarily designed to expose resources manipulated by PowerShell cmdlets and scripts as &lt;br /&gt;schematized ODATA entities using the semantics of representational state transfer (REST). The philosophy of REST ODATA limits the verbs that can be supported on resources to only the basic operations: Create, Read, Update and Delete.&amp;nbsp; &lt;br /&gt;In this topic I will talk about Management ODATA being able to expose resources that model PowerShell pipelines that return unstructured data. This is an optional feature and is called &amp;ldquo;&lt;strong&gt;PowerShell &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;pipeline invocation&lt;/strong&gt;&amp;rdquo;. A single Management ODATA endpoint can expose schematized resources, or the arbitrary cmdlet resources or both.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;In this blog I will show how to write a windows client built on WCF&amp;nbsp;that creates a PowerShell pipeline invocation on MODATA endpoint. Any client can be used that supports ODATA. WCF Data Services includes a set of client libraries for general .NET Framework client applications that is used in this example. You can read more about WCF at: &lt;a href="http://msdn.microsoft.com/en-us/library/cc668792.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc668792.aspx&lt;/a&gt;.&amp;nbsp;If you are building a WCF client, the only requirement is to use WCF Data Services 5.0 libraries to be compatible. In this topic I will assume you already have a MODATA endpoint configured and up and running. For more information on MODATA in general and how to create an endpoint please refer to msdn documentation at &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/hh880865(v=vs.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/hh880865(v=vs.85).aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Since &amp;ldquo;PowerShell pipeline invocation&amp;rdquo; feature is an optional feature and is disabled by default, you will need to enable it by adding the following configuration to your MODATA endpoint web.config:&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="638"&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;commandInvocation&amp;nbsp; enabled="true"/&amp;gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table 1.1 &amp;ndash; Enable Command Invocation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To make sure &amp;ldquo;PowerShell pipeline invocation&amp;rdquo; is now enabled, you will need to send a &lt;b&gt;GET&lt;/b&gt; &lt;a href="http://endpoint_service_URI/$metadata"&gt;http://endpoint_service_URI/$metadata&lt;/a&gt; query to MODATA endpoint and should see a similar response in return:&amp;nbsp;&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="638"&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;Schema&amp;gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;EntityType Name="CommandInvocation"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Key&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;PropertyRef Name="ID"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;/Key&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="ID" Nullable="false"&amp;nbsp; Type="Edm.Guid"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Command" Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Status" Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="OutputFormat"&amp;nbsp;&amp;nbsp; Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Output" Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Errors" Nullable="false" Type="Collection(PowerShell.ErrorRecord)"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="ExpirationTime"&amp;nbsp; Type="Edm.DateTime"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="WaitMsec" Type="Edm.Int32"/&amp;gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;/EntityType&amp;gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;ComplexType Name="ErrorRecord"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="FullyQualifiedErrorId"&amp;nbsp; Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="CategoryInfo"&amp;nbsp; Type="PowerShell.ErrorCategoryInfo"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="ErrorDetails"&amp;nbsp; Type="PowerShell.ErrorDetails"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Exception" Type="Edm.String"/&amp;gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;/ComplexType&amp;gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;ComplexType Name="ErrorCategoryInfo"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Activity"&amp;nbsp; Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Category"&amp;nbsp; Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Reason" Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="TargetName"&amp;nbsp; Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="TargetType"&amp;nbsp; Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;/ComplexType&amp;gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;ComplexType Name="ErrorDetails"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="Message" Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;Property Name="RecommendedAction"&amp;nbsp; Type="Edm.String"/&amp;gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;/ComplexType&amp;gt;&lt;br /&gt;&amp;lt;/Schema&amp;gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table 1.2&lt;/strong&gt; - &lt;b&gt;Command Invocation Schema Definition&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Management ODATA defines two ODATA resource sets related to PowerShell pipeline invocation: &lt;strong&gt;CommandDescriptions&lt;/strong&gt; and &lt;strong&gt;CommandInvocations&lt;/strong&gt;.&lt;br /&gt;The &lt;strong&gt;CommandDescriptions&lt;/strong&gt; resource set represents the collection of commands available on the server.&lt;br /&gt;By enumerating the resource set, a client can discover the commands that it is allowed to execute and their parameters.The client must be authorized to execute &lt;em&gt;Get-Command&lt;/em&gt; cmdlet for the &lt;strong&gt;CommandDescriptions&lt;/strong&gt; query to succeed. At a high level, if a client sends the following request:&amp;nbsp;&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="638"&gt;
&lt;p&gt;&amp;nbsp;GET &lt;a href="http://endpoint_service_URI/CommandDescriptions"&gt;http://endpoint_service_URI/CommandDescriptions&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table 1.3 &amp;ndash;&lt;/strong&gt; &lt;b&gt;Command Invocation Query Sample&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;hellip;then the server might reply with the following information:&amp;nbsp;&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="638"&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;entry&amp;gt;&lt;br /&gt;&amp;lt;id&amp;gt;http://endpoint_service_URI/CommandDescriptions('Get-Process')&amp;lt;/id&amp;gt;&lt;br /&gt;&amp;lt;category scheme="&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/scheme&lt;/a&gt;" term="PowerShell.CommandDescription"/&amp;gt;&amp;lt;link title="CommandDescription" href="CommandDescriptions('Get-Process')" rel="edit"/&amp;gt;&amp;lt;title/&amp;gt;&amp;lt;updated&amp;gt;2012-09-10T23:14:52Z&amp;lt;/updated&amp;gt;-&amp;lt;author&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;name/&amp;gt;&lt;br /&gt;&amp;lt;/author&amp;gt;-&amp;lt;content type="application/xml"&amp;gt;&lt;br /&gt;&amp;nbsp; -&amp;lt;m:properties&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;Get-Process&amp;lt;/d:Name&amp;gt;&amp;lt;d:HelpUrl m:null="true"/&amp;gt;&amp;lt;d:AliasedCommand m:null="true"/&amp;gt;-&amp;lt;d:Parameters m:type="Collection(PowerShell.CommandParameter)"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;Name&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.String[]&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;Id&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Int32[]&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;ComputerName&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.String[]&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;Module&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Management.Automation.SwitchParameter&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;FileVersionInfo&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Management.Automation.SwitchParameter&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;InputObject&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Diagnostics.Process[]&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;Verbose&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Management.Automation.SwitchParameter&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;Debug&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Management.Automation.SwitchParameter&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;ErrorAction&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Management.Automation.ActionPreference&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;WarningAction&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.Management.Automation.ActionPreference&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;ErrorVariable&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.String&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;-&amp;lt;d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Name&amp;gt;WarningVariable&amp;lt;/d:Name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ParameterType&amp;gt;System.String&amp;lt;/d:ParameterType&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/d:Parameters&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/m:properties&amp;gt;&lt;br /&gt;&amp;lt;/content&amp;gt;&lt;br /&gt;&amp;lt;/entry&amp;gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table 1.4 &amp;ndash;&lt;/strong&gt; &lt;b&gt;Command Response Sample&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;This indicates that the client is allowed to execute the Get-Process cmdlet.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;CommandInvocations&lt;/strong&gt; resource set represents the collection of commands or pipelines that have been invoked on the server.&amp;nbsp; Each entity in the collection represents a single invocation of some PowerShell pipeline.&amp;nbsp; To invoke a pipeline, the client sends a &lt;strong&gt;POST&lt;/strong&gt; request containing a new entity.&amp;nbsp; The contents of the entity include the PowerShell pipeline itself (as a string), the desired output format (typically &amp;ldquo;&lt;em&gt;xml&lt;/em&gt;&amp;rdquo; or &amp;ldquo;&lt;em&gt;json&lt;/em&gt;&amp;rdquo;), and the length of time to wait synchronously for the command to complete.&amp;nbsp; A pipeline string is a sequence of one or more commands, optionally with parameters and delimited by a vertical bar character. For example, if the server receives the pipeline string &amp;ldquo;&lt;em&gt;Get-Process &amp;ndash;Name iexplore&lt;/em&gt;&amp;rdquo;,with output type specified as &amp;ldquo;&lt;em&gt;xml&lt;/em&gt;&amp;rdquo; then it will execute the Get-Process command (with optional parameter Name set to &amp;ldquo;&lt;em&gt;iexplore&lt;/em&gt;&amp;rdquo;), and send its output to &amp;ldquo;&lt;em&gt;ConvertTo-XML&lt;/em&gt;&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;The server begins executing the pipeline when it receives the request.&amp;nbsp; If the pipeline completes quickly (within the synchronous-wait time) then the server stores the output in the entity&amp;rsquo;s &lt;em&gt;Output&lt;/em&gt; property, marks the invocation status as &amp;ldquo;&lt;em&gt;Completed&lt;/em&gt;&amp;rdquo;, and returns the completed entity to the client.&lt;/p&gt;
&lt;p&gt;If the synchronous-wait time expires while the command is executing, then the server marks the entity as &amp;ldquo;Executing&amp;rdquo; and returns it to the client.&amp;nbsp; In this case, the client must periodically request the updated entity from the server; once the retrieved entity&amp;rsquo;s status is &amp;ldquo;&lt;em&gt;Completed&lt;/em&gt;&amp;rdquo;, then the pipeline has completed and the client can inspect its output. The client should then send an ODATA &lt;em&gt;DeleteEntity&lt;/em&gt; request, allowing the server to delete resources associated with the pipeline.&lt;/p&gt;
&lt;p&gt;There are some important restrictions on the types of commands that can be executed. Specifically, requests that use the following features will not execute successfully:&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;1.&amp;nbsp;script blocks&lt;br /&gt;2.&amp;nbsp;parameters using environment variables such as "Get-Item -path $env:HOMEDRIVE\\Temp"&lt;br /&gt;3.&amp;nbsp;interactive parameters such as &amp;ndash;Paging (Get-Process | Out-Host &amp;ndash;Paging )&lt;/p&gt;
&lt;p&gt;Authorization and PowerShell initial session state are handled by the same CLR interfaces as for other Management ODATA resources. Note that every invocation calls some &lt;em&gt;ConvertTo-XX&lt;/em&gt; cmdlet, controlled by the &lt;em&gt;OutputFormat&lt;/em&gt; property of the invocation. The client must be authorized to execute this cmdlet in order for the invocation to succeed.&lt;/p&gt;
&lt;p&gt;Here is the code snippet that shows how to send a request to create a PowerShell pipeline invocation and how to get the cmdlet execution result:&amp;nbsp;&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="638"&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; public class CommandInvocationResource&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Guid ID { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Command { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string OutputFormat { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int WaitMsec { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Status { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Output { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public List&amp;lt;ErrorRecordResource&amp;gt; Errors { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public DateTime ExpirationTime { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public CommandInvocationResource()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Errors = new List&amp;lt;ErrorRecordResource&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class ErrorRecordResource&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string FullyQualifiedErrorId { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public ErrorCategoryInfoResource CategoryInfo { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public ErrorDetailsResource ErrorDetails { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Exception { get; set; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class ErrorCategoryInfoResource&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Activity { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Category { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Reason { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string TargetName { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string TargetType { get; set; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class ErrorDetailsResource&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Message { get; set; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string RecommendedAction { get; set; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table 2.1 &amp;ndash; Helper class definitions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="638"&gt;
&lt;p&gt;&lt;span style="background-color: #ccffcc;"&gt;&amp;nbsp;// user needs to specify the endpoint service URI as well as provide user name, password and domain&lt;/span&gt;&lt;br /&gt;Uri serviceroot = new Uri(&amp;ldquo;&amp;lt;endpoint_service_URL&amp;gt;&amp;rdquo;);&lt;br /&gt;NetworkCredential serviceCreds = new NetworkCredential("testuser","testpassword","testdomain");&lt;br /&gt;CredentialCache cache = new CredentialCache();&lt;br /&gt;cache.Add(serviceroot, "Basic", serviceCreds);&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ccffcc;"&gt;&lt;span style="background-color: #ccffcc;"&gt;//Powershell pipeline invocation command sample&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;string strCommand ="Get-Process -Name iexplore";&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ccffcc;"&gt;&lt;span style="background-color: #ccffcc;"&gt;// Expect returned data to be xml formatted. You can set it to &amp;ldquo;json&amp;rdquo; for the returned data to be in json&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;string outputType = "xml";&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ccffcc;"&gt;//create data service context with protocol version 3 to connect to your endpoint. V3 supports all new ODATA fetures like property bags that is required for "PowerShell cmdlet invocation" feature&lt;/span&gt;&lt;br /&gt;DataServiceContext context = new DataServiceContext(serviceroot,System.Data.Services.Common.DataServiceProtocolVersion.V3);&lt;br /&gt;context.Credentials = cache;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ccffcc;"&gt;//Create an invocation instance on the endpoint&lt;/span&gt;&lt;br /&gt;CommandInvocationResource instance = new CommandInvocationResource()&lt;br /&gt;{&lt;br /&gt;Command = strCommand,&lt;br /&gt;OutputFormat = outputType&lt;/p&gt;
&lt;p&gt;};&lt;br /&gt;context.AddObject("CommandInvocations", instance);&lt;br /&gt;DataServiceResponse data = context.SaveChanges();&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ccffcc;"&gt;// Ask for the invocation instance we just created&lt;/span&gt;&lt;br /&gt;DataServiceContext afterInvokeContext&amp;nbsp;&amp;nbsp;&amp;nbsp; = new DataServiceContext(serviceroot, &lt;br /&gt;System.Data.Services.Common.DataServiceProtocolVersion.V3);&lt;br /&gt;afterInvokeContext.Credentials = cache;&lt;br /&gt;afterInvokeContext.MergeOption = System.Data.Services.Client.MergeOption.OverwriteChanges;&lt;br /&gt;CommandInvocationResource afterInvokeInstance = afterInvokeContext.CreateQuery&lt;br /&gt;&amp;lt;CommandInvocationResource&amp;gt;("CommandInvocations").Where(it =&amp;gt; it.ID == instance.ID).First();&lt;/p&gt;
&lt;p&gt;Assert.IsNotNull(afterInvokeInstance, "instance was not found!");&lt;br /&gt;while (afterInvokeInstance.Status == "Executing")&lt;br /&gt;{&lt;br /&gt;&lt;span style="background-color: #ccffcc;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Wait for the invocation to be completed&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Thread.Sleep(100);&lt;br /&gt;&amp;nbsp;&amp;nbsp; afterInvokeInstance = afterInvokeContext.CreateQuery&amp;lt;CommandInvocationResource&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; ("CommandInvocations").Where(it =&amp;gt; it.ID == instance.ID).First();&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;if (afterInvokeInstance.Status == "Completed")&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="background-color: #ccffcc;"&gt; //Results is returned as a string in afterInvokeInstance.Output variable in xml format&lt;/span&gt;&lt;br /&gt;}&amp;nbsp;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&lt;span style="background-color: #ccffcc;"&gt;// In case the command execution has errors you can analyze the data&lt;/span&gt;&lt;br /&gt;if (afterInvokeInstance.Status == "Error")&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string errorOutput;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;ErrorRecordResource&amp;gt; errors = afterInvokeInstance.Errors;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ErrorRecordResource error in errors)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; errorOutput += "CategoryInfo:Category " + error.CategoryInfo.Category + "\r\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errorOutput += "CategoryInfo:Reason " + error.CategoryInfo.Reason + "\r\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; errorOutput += "CategoryInfo:TargetName " + error.CategoryInfo.TargetName + "\r\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errorOutput += "Exception " + error.Exception + "\r\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errorOutput += "FullyQualifiedErrorId " + error.FullyQualifiedErrorId + "\r\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errorOutput += "ErrorDetails" + error.ErrorDetails + "\r\n"; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ccffcc;"&gt;//Delete the invocation instance on the endpoint&lt;/span&gt;&lt;br /&gt;afterInvokeContext.DeleteObject(afterInvokeInstance);&lt;br /&gt;afterInvokeContext.SaveChanges();&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table 2.2 &amp;ndash;&lt;/strong&gt; &lt;b&gt;Client Code Implementation&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Narine Mossikyan&lt;br /&gt;Software Engineer in Test&lt;br /&gt;Standards Based Management&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10348021" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/wmi/archive/tags/MODATA/">MODATA</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/CommandDescriptions/">CommandDescriptions</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/Management+ODATA/">Management ODATA</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/CommandInvocations/">CommandInvocations</category><category domain="http://blogs.msdn.com/b/wmi/archive/tags/PowerShell+arbitrary+cmdlets+invocation/">PowerShell arbitrary cmdlets invocation</category></item><item><title>Introduction to CIM Cmdlets</title><link>http://blogs.msdn.com/b/wmi/archive/2012/08/29/introduction-to-cim-cmdlets.aspx</link><pubDate>Wed, 29 Aug 2012 19:04:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10344757</guid><dc:creator>Vaibhav Chugh</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10344757</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2012/08/29/introduction-to-cim-cmdlets.aspx#comments</comments><description>&lt;p&gt;We recently posted a blog post related to our new CIM Cmdlets. The post is&amp;nbsp;available&amp;nbsp;on the powershell blog at the following link:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/powershell/archive/2012/08/24/introduction-to-cim-cmdlets.aspx"&gt;http://blogs.msdn.com/b/powershell/archive/2012/08/24/introduction-to-cim-cmdlets.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;We would love to know what you think about these new cmdlets. Please feel free to leave&amp;nbsp;your comments below or on the powershell blog.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Vaibhav Chugh [MSFT], WMI&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10344757" width="1" height="1"&gt;</description></item><item><title>Standards Based Hardware Management using PowerShell</title><link>http://blogs.msdn.com/b/wmi/archive/2012/08/08/standards-based-hardware-management-using-powershell.aspx</link><pubDate>Wed, 08 Aug 2012 19:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10337999</guid><dc:creator>Steve Lee [MSFT]</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/wmi/rsscomments.aspx?WeblogPostID=10337999</wfw:commentRss><comments>http://blogs.msdn.com/b/wmi/archive/2012/08/08/standards-based-hardware-management-using-powershell.aspx#comments</comments><description>&lt;p&gt;In my last post, I discussed the concept of &lt;a href="http://dmtf.org/standards/profiles"&gt;DMTF Management Profiles&lt;/a&gt; and in this blog post I&amp;rsquo;m going to discuss applying them.&amp;nbsp; Standards (particularly adopted ones) enable not only interoperability, but also reuse of tools.&amp;nbsp; WS-Man enables a common remote management protocol.&amp;nbsp; CIM Schema enables consistent models of management elements.&amp;nbsp; DMTF Management Profiles enable consistent implementations of CIM models for a specific management domain.&amp;nbsp; However, these standards are not sufficient for ITPros to easily manage their datacenter because although all the pieces are there, they were not designed to be easy to use (for ITPros).&lt;/p&gt;
&lt;p&gt;PowerShell enables ITPros make easily make sense of this complexity, but only if there is an appropriate admin task abstracted cmdlet.&amp;nbsp; In &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=29939"&gt;WMF3.0&lt;/a&gt;, we added new CIM cmdlets (get-ciminstance, invoke-cimmethod, etc&amp;hellip;) that enable managing a remote CIM enabled node (over WS-Man by default), however, these cmdlets still require understanding of CIM, in some cases WS-Man, and certainly the DMTF Management Profile.&amp;nbsp; These cmdlets were targeted more for the ITPro developer.&lt;/p&gt;
&lt;p&gt;To solve this problem, I built a &lt;a href="http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Out-of-Band-84009c12"&gt;PowerShell module&lt;/a&gt; that uses the CIM cmdlets (and thus requires &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=29939"&gt;WMF3.0&lt;/a&gt;) and abstracts the details of CIM and Profiles to (mostly) simple admin task abstracted cmdlets.&amp;nbsp; For the first release of this module, I&amp;rsquo;m targeting some common admin tasks: Getting hardware information, getting software information, getting and setting power state, getting and setting the boot order, getting the OS status, getting numeric sensors, and getting record logs and log entries.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/7026.image_5F00_4C254620.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/2211.image_5F00_thumb_5F00_30148735.png" alt="image" width="787" height="353" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here I create two CimSessions, one to a desktop system that has the Broadcom DASH implementation and one to a desktop that has Intel&amp;rsquo;s AMT implementation.&amp;nbsp; You&amp;rsquo;ll notice that the two systems listen on different ports.&amp;nbsp; Port 623 is the HTTP port required by DASH conformant implementations.&amp;nbsp; Intel's AMT supports both the DASH port (623) as well as an AMT specific port.&amp;nbsp; In this example, I illustrate what it would look like to use two different ports.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/0167.image_5F00_6BD41FE8.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/7024.image_5F00_thumb_5F00_1DCBC073.png" alt="image" width="787" height="354" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now, let&amp;rsquo;s turn on the first system.&amp;nbsp; Retrieving the power state again, you can see that we were able to remotely turn on that system even though the OS was not running and the hardware was in a sleep (standby) state.&amp;nbsp; The RequestedState showing Offline is a known issue.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/8585.image_5F00_2B9E066E.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/0488.image_5F00_thumb_5F00_5D95A6F8.png" alt="image" width="788" height="354" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next, let&amp;rsquo;s gather some inventory information which uses multiple Management Profiles.&amp;nbsp; Here you can see that the default formatting only shows a summary in tabular format while piping the same output to a list view shows all the information returned by the two respective implementations.&amp;nbsp; Also notice that in many cases, I use the CIM values/valuemap data to convert integers to their textual counterparts.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/3617.image_5F00_56766A80.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/4606.image_5F00_thumb_5F00_365B5DC3.png" alt="image" width="788" height="621" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next, let&amp;rsquo;s see what software (meaning firmware in the case of hardware) is on these two systems:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/2543.image_5F00_0B16C6BC.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/6837.image_5F00_thumb_5F00_6AFBB9FE.png" alt="image" width="788" height="311" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Finally, a common operation you would want to do in hardware is to change the boot order.&amp;nbsp; For example, let&amp;rsquo;s say you wanted to do a one-time network (PXE) boot to install the operating system.&amp;nbsp; Here, we retrieve the current boot sources and configuration.&amp;nbsp; Then we change the boot source to Network and finally retrieve the boot information again to confirm the change will be used:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/4784.image_5F00_63DC7D86.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-21-metablogapi/8507.image_5F00_thumb_5F00_2ECFEE56.png" alt="image" width="787" height="376" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As you can see, the complexities of CIM and Management Profiles are hidden with the PowerShell module so the ITPro only needs to focus on the tasks they care about without needing to understand the implementation details.&amp;nbsp; The module itself is written as PowerShell script so you can see how everything works.&amp;nbsp; You&amp;rsquo;ll note that I have many TODOs in the module which means that I will continue to improve upon this module with additional capabilities in the future.&lt;/p&gt;
&lt;p&gt;The module is available on TechNet here: &lt;a href="http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Out-of-Band-84009c12"&gt;PowerShell Out-of-Band Hardware Management Module&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Steve Lee [MSFT] &lt;br /&gt;Principal Test Manager &lt;br /&gt;Standards Based Management&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10337999" width="1" height="1"&gt;</description></item></channel></rss>