Project Description

A simple yet powerful ASP.NET control collection that lets you execute PowerShell scripts within an ASP.NET page.

PowerShell with ASP.NET Page Events

You can have zero or more elements for a particular Page event and execute PowerShell script as a response to the event. Output objects are converted to strings and rendered, or use of the ASP.NET objects you'd expect to be available is acceptable as well.

<PowerShell:Runspace ID="runspace" runat="server">
        $Response.Write("OnInit<br />")
        $Response.Write("OnLoad<br />")
    <OnLoad Source="~/ExternalPowerShellScript.ps1" />
        "OnRender<br />"
        $Response.Write("OnUnload<br />")

PowerShell Data Binding

Creating ASP.NET DataSource containers for binding to ASP.NET controls makes it very easy to render PowerShell object output.

<PowerShell:DataSource ID="ServicesDataSource" runat="server">
    Get-WmiObject Win32_Service

<asp:Repeater runat="server" DataSourceID="ServicesDataSource">
      <%# DataBinder.Eval(Container.DataItem, "DisplayName") %> 
        (<%# DataBinder.Eval(Container.DataItem, "Name") %>)
         <%# DataBinder.Eval(Container.DataItem, "State") %>

Last edited Jul 20, 2012 at 10:35 PM by adweigert, version 5