Skip to content


PowerShell from ASP.NET and System.Management.Automation – SOLVED!

Wow, this took a long time to figure out, but now I can tell you exactly how to get the System.Management.Automation namespace into yout web site in order to run PowerShell commands.

1. You need to download the Windows SDK.  Download it from here:

2. When installing the above SDK, be sure to follow these instructions:

3. Reboot the machine.

4. Open the web.config file in your website and add the following:

    <compilation debug=”true”>
            <add assembly=”System.Management.Automation, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>

5. On the page that you want to do PowerShell things from, put this at the top:

using System.Management.Automation.Runspaces;
using System.Management.Automation;

6. Follow this article for a demo of how to execute commands:


Posted in Uncategorized.

Tagged with , .

2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. best registry cleaner says

    Nice post…Thank you for sharing some good things!!

  2. Jakke says

    this has worked form me on 2008 but on 2010 version it no longer works.
    Any idea?