Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

EsOsO/PowershellHttpHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowershellHttpHandler

IIS Http Handler to execute Powershell files

Installation

Place PowershellHttpHandler.dll in the \bin folder of your ISS site

Edit web.config with:

<configuration>
    <system.webServer>
        <handlers>
            <add name="Powershell" path="*.ps1" verb="*" type="System.Web.Handlers.PowershellHandler" preCondition="integratedMode" />
        </handlers>
        <defaultDocument>
            <files>
                <add value="index.ps1" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>

Usage

Example index.ps1

@"
<html>
  <head>
    <title>Powershell Handler Test</title>
  </head>
  <body>
    <p>Hello, $(Get-Variable $HttpContext.Request.LogonUserIdentity)!</p>
  </body>
</html>
"@

The variable $HttpContext is passed on every page and contains the server HttpContext object.

Config

If you want to configure your webapp you could place a file named \App_code\config.ps1 that will be executed on session start.

About

IIS Http Handler to execute Powershell files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages