Saturday, May 12, 2012

Marrying up PowerShell, JSON and OData to provide server management as Management OData

Adam Driscoll's Blog - Management OData and PowerShell

"There is a new feature of Windows Server 8 that will allow for access to PowerShell cmdlets and objects via OData served through ASP.NET. Doug Finke wrote a blog post for PowerShell Magazine on the topic. The article gives a good overview of what the Management OData feature is and how to configure it. In this blog post I will be showing off some of the steps involved in getting the service configured and what it looks like to consume the OData in PowerShell.


What Management OData Does

In simple terms (read Doug’s post for more info), the Management OData service provides RESTful endpoints that server up PowerShell objects. The schema designer is used to map cmdlets and their resulting objects to OData objects. These can then be served as JSON back through the endpoint to the client. The Management OData Schema Designer is used to take existing modules, cmdlets and objects and map them to XML files that can then be consumed by the Management OData system and served to clients. Included with the examples are PowerShell scripts used to install the OData endpoints once they have been compiled.



This is a Windows Server 2012 feature I'd not heard of and sounds both awesome and scary at the same time. The good news is that it seems this isn't some auto-magic thing that once installed, everything is exposed. If I understand it right, there's a bit of setup/config required to expose specific powershell cmdlets, which is good. And I wonder about the security story, but still the thought of being able to interact with remote powershell cmdlets via OData and JSON sounds exciting. I'll be keeping an eye on this now going forward...

No comments: