PowerShell Server 2016
PowerShell Server 2016
Questions / Feedback?

Configuring PowerShell ASP

PowerShell ASP can be easily configured in IIS 6 and up. Details of the procedure to do so are included below. Additional functionality is also discussed in separate sections on this page.

IIS 7 and IIS 8 Integrated Pipeline Mode

  1. Create a new ASP.NET Web Site or Application.
  2. Add a reference to PowerShellASP.dll, or copy it to your web site's ./bin folder.
  3. Register the PowerShell ASP HttpHandlers in your Web.config file:
    <system.webServer>
       <handlers>
          <add name='PowerShellASP' path='*.ps1x' verb='GET,POST'
             type='nsoftware.PSHandler, nsoftware.PowerShellASP'/>
          <add name='PowerShellRSS' path='*.rs1x' verb='GET,POST'
             type='nsoftware.PSRSSHandler, nsoftware.PowerShellASP'/>
          <add name='PowerShellRSSAtom' path='*.as1x' verb='GET,POST'
             type='nsoftware.PSRSSHandler, nsoftware.PowerShellASP'/>
       </handlers>
    </system.webServer>
     

IIS 6

  1. Create a new ASP.NET Web Site or Application.
  2. Add a reference to PowerShellASP.dll, or copy it to your web site's ./bin folder.
  3. Register the PowerShell ASP HttpHandlers in your Web.config file:
    <httpHandlers>
       <add verb='GET,POST' path='*.ps1x' 
          type='nsoftware.PSHandler, nsoftware.PowerShellASP'/>
       <add verb='GET,POST' path='*.rs1x' 
          type='nsoftware.PSRSSHandler, nsoftware.PowerShellASP'/>
       <add verb='GET,POST' path='*.as1x' 
          type='nsoftware.PSRSSHandler, nsoftware.PowerShellASP'/>
    </httpHandlers>
     
  4. If you have not done so before, configure the *.ps1x and *.rs1x extensions to be mapped to the ASP.NET ISAPI extension library in your IIS application.

Additional Settings

This section describes additional settings that can be used to alter the default behavior of PowerShell ASP. The settings listed below can be specified in the "appSettings" section of the web.config. For instance:

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <system.web>
  ...
  </system.web>
  <system.webServer>
  ...
  </system.webServer>
  <appSettings>
    <add key="PSASPRunspaceQueueSize" value="10"/>
    <add key="PSASPRunProfiles" value="true"/>    
    <add key="PSASPProfile" value="../profile.ps1"/>
  </appSettings>
</configuration>

SettingDescription
PSASPRunspaceQueueSizeSpecifies the number of PowerShell Runspaces to pre-create. When a client connects, a pre-created runspace will be used. This can reduce overhead as runspaces are not created on demand. The runspace is always destroyed when a client disconnects, and runspaces are pre-created to maintain the number of pre-created runspaces specified here. The default value is 1.
PSASPRunProfilesWhen set to true, PowerShell ASP will attempt to load and run profiles automatically. See the "Profile Execution" help page for more detail.
PSASPProfileSpecifies the location of a custom PowerShell profile to load.

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
PowerShell Server 2016 - Version 16.0 [Build 6446]