开发者

Framework for GUI on top of Powershell?

The Powershell team preaches using GUI on top of Powershell (GUI actions t开发者_如何学编程ranslated into Powershell commands in the background and executed).

I love the idea, specially b/c it would make my GUI scriptable (it's nice to click click and then see a trace window with all the cmdlets that I've executed).

My question is, do they provide some kind of framework/library to implement such GUI over Powershell architecture?


Well the idea is that you build a traditional GUI-based management application and host PowerShell to do the real work via your cmdlets. MMC snapins are one way to go if you don't want to implement an entire application. These days you can use .NET/WinForms to build MMC snapins. That is the model the Exchange server uses. MMC 3.0 supports managed snapins - this MSDN article discusses how to do this. After that it should be pretty simple to take information from the GUI and translate that into the appropriate calls to your cmdlets.


PowerShell doesn't offer anything when it comes to the "GUI" part of the "GUI over Cmdlets" approach, but it does make the "over cmdlets" part easy.

The two approaches are:

  • Use PowerShell's Hosting API
  • Use the .Invoke() method on actual cmdlets

The PowerShell Cmdlet Designer demonstrates both.

Lee Holmes [MSFT]
Windows PowerShell Development


WPF is scriptable through Powershell

Check out this post on the Windows PowerShell blog

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜