Skip to content
rprieto edited this page Sep 14, 2010 · 32 revisions

Intro

Welcome to psDeploy, a deployment automation library for Powershell. This small-footprint package provides additional cmdlets for common interaction with Windows during deployment processes.

Adding the psDeploy module to your development / test / production servers allows you to automate the teardown or setup of your environments, thus limiting the need for manual configuration and documentation.

The cmdlets are grouped into 2 categories:

Requirements

The main requirement of psDeploy is Powershell 2.0.
Powershell 2.0 officially requires at least the following versions of Windows:

  • Windows XP Service Pack 3
  • Windows Vista Service Pack 1
  • Windows Server 2003 Service Pack 2
  • Windows Server 2008 Service Pack 1

However, it is possible to install it on Windows XP SP2 by following these steps: Windows XP SP2

How to use psDeploy

  1. Install Powershell 2.0 if necessary, from http://support.microsoft.com/kb/968929
  2. Go to the psDeploy download page and download the latest version
  3. Extract the ZIP contents to any of the powershell module paths, which you can list with $env:psmodulepath
  4. Add the following lines at the top of your script:

Import-Module psDeploy
Assert-PsDeploySupported

Simple examples

psDeploy simply adds new cmdlets that can be used within a deployment scripts, such as:

Stop-IIS6AppPool -Name “MyPool”
New-LocalUser -Name “Bob” -Password “123456”
Expand-Zip -File “C:\Builds\Version3.zip” -Destination “C:\MyService” -CleanDestinationFirst
New-ScheduledTask -Name “MyTask” -Path “C:\Task.exe” -Every 2 -Weeks -On “Mon,Wed” -At 18:30

The commandlets will usually have one of the following outcome:

  • Be successful and print a success message, for ex. Created new user 'Bill'
  • Print a message if no action was taken, for ex. The app pool 'MyWeb' was already stopped
  • Throw an exception detailing the reason of the failure

Logging the deployment

psDeploy also comes with an initialisation commandlet, which will take care of common deployment aspects:

Initialize-PsDeploy -FailFast -LogPath “C:\DeploymentLogs”
Initialize-PsDeploy -FailFast -LogPath “C:\DeploymentLogs” -LogName “LastDeployment.log”

  • The FailFast switch makes the script fail at the first error (Powershell usually keeps going after an error)
  • LogPath is a path to a folder that will contain the log of everything that happens
  • LogName is the name of the log, which defaults to the current timestamp if not provided

psDeploy uses transcripts for logging purposes, which means logging will only be available when running the scripts from the powershell.exe host. It will simply be ignored when running from Powershell ISE.

Additional notes

psDeploy is still in early stages of development. Unfortunately this means some cmdlet or parameter names might change occasionally. However it also means that the library is constantly growing and improving! Please feel free to post ideas of useful cmdlets, or to file bug reports.


Romain Prieto & Martin Hollingsworth
Clone this wiki locally