PSAdmin Installation Guide
PSAdmin is an ASP.NET MVC Web Application. It uses an SQLite database for storage.
I will not go into how to install IIS and the .NET framework as this varies depending on your operating system. You should find all the necessary information on how to install these from the links above or a quick Google.
In order to execute PowerShell scripts using ASP.NET, you first need to ensure that PowerShell is installed (see above link). In later versions of Microsoft's Operating Systems (Windows 7/Server 2008) it is installed by default.
We also need to ensure that the System.Management.Automation assembly is installed. Again, on later versions this is there by default. If not you will need to install it by running the
Windows SDK Installer
. An easy way of checking to see if the assembly is installed is to browse to C:\Windows\Assembly (the Global Assembly Cache) and searching for System.Management.Automation:
If you are running PSAdmin on a 32bit machine then you will need the 32 bit version of System.Data.SQLite. The easiest way of installing this is by downloading the installer from
. Once installed you can grab the assembly from the install location and override the 64bit version in the web site's bin directory.
- Download the latest release version from
http://psadmin.codeplex.com/releases (currently 22.214.171.124 Alpha)
- Extract the zip archive on your machine
- Create a new directory for your web site e.g. c:\inetpub\wwwroot\PSAdmin and copy the contents of the install package to it:
- Open up connectionStrings.config in notepad and update the connection string. The connection string name should be the host name of your computer. The connectionString should be the full path to the psadmin database file:
<add name="Jasper" connectionString="Data Source=C:\\Inetpub\\wwwroot\\PSAdmin\\App_Data\\psadmin.db;Version=3"/>
- Next update the AdminUsers setting in web.config to to include your fully qualified username i.e. domain\username. This is necessary so that when the application runs for the first time you will be added to the administrators group and will therefore be
able to access the administrative functions.
<add key="AdminUsers" value="jasper\administrator"/>
- Open up IIS Manager (Start > Run > inetmgr) and make the PSAdmin directory an application (right click the PSAdmin directory and select Convert To Application).
Note that the process for making a virtual directory an application is slightly different in IIS6 - if you get stuck then please post to the discussions section
- With the PSAdmin application selected in IIS Manager, in the features panel open the authentication settings. Disable anonymous authentication and enable Windows Authentication (since PSAdmin uses Windows Authentication to authenticate users):
That should be all that's necessary to get the web site loading. If you navigate to http://localhost/PSAdmin (or whatever you named your web site) PSAdmin should load.
Setting the PowerShell Execution Policy
The default Execution Policy in PowerShell doesn't allow you to do much so you will most likely want to set this to RemoteSigned (see
for details on how to do this)
So that impersonation can flow between the ASP.NET runtime and the PowerShell runspace (necessary if you wish to enable impersonation on any of your scripts) you need to make a change to the global aspnet.config file.
Open up C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet.config and set alwaysFlowImpersonationPolicy to true:
<?xml version="1.0" encoding="UTF-8" ?>
<legacyUnhandledExceptionPolicy enabled="false" />
<SymbolReadingPolicy enabled="1" />
You will then need to reboot your machine for the new setting to be registered.
There are a few sample scripts in the psadmin_sample.db file inside the App_Data directory. You can rename this to psadmin.db if you wish to review these scripts.