Skip to content
Johan Leino edited this page Jun 16, 2013 · 13 revisions

This module is used when you want to perform a content backup of your IIS site before you deploy a new version to it. Internally it uses the Backup-WDApp Cmdlet and that in itself is just a fancy wrapper around the iisApp Provider.


Hello World

First install via NuGet Install-Package WDP.Backup.

Given that the WDP.Backup.psm1 script file exists in the same direcory from where you execute it here's a basic example that backups a local IIS site called test.xample.com

Import-Module .\WDP.Backup.psm1

Invoke-Backup test.xample.com

The Conventions (the defaults)

Below is a listing of all the conventions (the defaults) that we're using. If you don't like them just change them.

* SourcePublishSettingsFiles ([ string[] ])

default: optional [not set]

We will backup the site on the local IIS server that the script is running on.

If you wish to backup a site on a remote, or several, server this property will contain an array of the paths to .publishsettings files that represents these servers.

* BackupLocation ([ string ])

default: .Backups

We will place all the backups in the current directory + a sub directory called Backups.

* PublishArtifacts ([ bool ])

default: [set by TeamCity]

The default is if the code executes within TeamCity this parameter will default to true. Otherwise it's false.

It controls whether or not the backup file will be published as a build artifact in TeamCity.


Changing The Conventions

If you don't like the conventions (defaults) that we have setup you can always change them. The basic idea is that you'd call Set-Properties before invoking the function with a the keys and values you'd like to change.

Example - backing up two remote servers and turning off artifact publishing

Import-Module .\WDP.Backup.psm1

Set-Properties @{
SourcePublishSettingsFiles = @(".\serverA.publishsettings",".\serverB.publishsettings")
PublishArtifacts = $false
}

Invoke-Backup test.xample.com