Powershell for EPiServer Applications

Product version:

EPiServer CMS 5 R2 SP1

Document version:

1.0

Document last saved:

Introduction

Windows PowerShell is both a scripting language and an interactive command line shell.
EPiServer uses PowerShell scripts to create, delete and manipulate EPiServer CMS and Community Web sites. This is performed from the EPiServer Deployment Center (previously called EPiServer Installation Manager).
More information about Windows PowerShell can be found on MSDN and on Microsoft.com.

Cmdlets

A Cmdlet (pronounced commandlet) is essentially a function callable from PowerShell (both scripts and interactive). A Cmdlet is build in managed .NET code by deriving a class from either System.Management.Automation.Cmdlet or System.Management.Automation.PSCmdlet. The Cmdlet name as callable from PowerShell is derived from a verb and noun combination. The verb describes what the Cmdlet does, e.g. “Get”, “Set”, “New”, “Delete” etc, whilst the noun describes what the verbs acts upon, e.g. “File”, “Site” etc.
See PowerShell Managed Reference on MSDN for more details of Cmdlets.

Snap-ins

A .NET assembly containing Cmdlets is known as a Snap-in. A Snap-in assembly must be registered in the Windows Registry before its Cmdlets can be used from PowerShell. This registration is normally done by the installer (e.g. Windows Installer) for the application the Snap-in is a part of. Alternatively, a class may be derived from System.Management.Automation.PSSnapin and marked with the System.ComponentModel.RunInstallerAttribute attribute. By implementing this class with the relevant information for the Snap-in, it can self register when used with a installer aware tool such as Microsoft's Installer Tool (Installutil.exe).

EPiServer Common Snap-in

EPiServer has implemented such a Snap-in to expose its Install API to PowerShell. The name of the Snap-in is ‘EPiServer.Install.Common.1’. You use this name in PowerShell when invoking the Add-PSSnapin cmdlet. See How to Register Cmdlets for more information.
The cmdlets in the EPiServer.Install.Common.1 snap-in can be used to simplify installations. To get more information about a cmdlet, use the “Get-Help” command let to get more information (example, Get-Help Begin-EPiBulkInstall). The snap in exists in the assembly “EPiServerInstall.Common.1.dll”.

EPiServer Common Cmdlets

The following is a list of Cmdlets implemented in the EPiServer.Install.Common.1 snap-in:
• Add-EPiAssemblyRedirect
• Add-EPiProgressPercentComplete
• Add-EPiSqlSvrUser
• Add-EPiXmlAttribute
• Add-EPiXmlBlock
• Begin-EPiBulkInstall
• Commit-EPiBulkInstall
• Copy-EPiFiles
• Execute-EPiSqlSvrScript
• Get-EPiIsBulkInstalling
• Get-EPiProductInformation
• Get-EPiRandomPassword
• Get-EPiRegistryValue
• Get-EPiSqlSvrCommand
• Get-EPiUniqueMachineKey
• Get-EPiWebApp
• Get-EPiWebServer
• Get-EPiVersion
• Get-EPiXmlNodeExists
• Move-EPiDirectory
• Move-EPiFile
• New-EPiDirectory
• New-EPiSqlSvrDB
• New-EPiWebApp
• New-EPiWebVirtualDirectory
• Remove-EPiDirectory
• Remove-EPiFiles
• Remove-EPiRegistryValue
• Remove-EPiSqlSvrDB
• Remove-EPiSqlSvrUser
• Remove-EPiWebApp
• Remove-EPiXmlNode
• Rollback-EPiBulkInstall
• Set-EPiAccess
• Set-EPiProgressStatus
• Set-EPiRegistryValue
• Set-EPiXmlAttribute
• Unload-EPiSite
• Update-EPiXmlFile
More detailed information can be found for each cmdlet by running the Get-Help cmdlet in PowerShell and specifying the cmdlet’s name. E.g.
Get-Help Get-EPiWebApp

EPiServer CMS Snap-in

EPiServer CMS also has its own PowerShell snap-in to provide access the CMS specific parts of the EPiServer Install API.
In EPiServer CMS R2, the snap-in name is EPiServer.Install.SnapIn.5.2.375.7. In R2 SP1 the snap-in has changed name to EPiServer.Install.CMS.xx.xx.xx.xx where xx.xx.xx.xx is the version number of the CMS R2 SP1 release.

EPiServer CMS R2 Cmdlets

The following is a list of Cmdlets implemented in the EPiServer.Install.SnapIn.5.2.375.7 snap-in:
*Note:  The majority of the cmdlets in EPiServer.Install.SnapIn.5.2.375.7 were replaced by an equivalent in EPiServer.Install.Common.1. EPiServer.Install.Common.1 ships with EPiServer Relate+, EPiServer Community 3 and EPiServer CMS 5 R2 SP1.
• Abort-EPiBulkInstall
• Add-EPiProgressPercentComplete
• Add-EPiServerData
• Add-EPiSqlSvrUser
• Add-EPiXmlAttribute
• Add-EPiXmlBlock
• Begin-EPiBulkInstall
• Commit-EPiBulkInstall
• Copy-EPiFiles
• Execute-EPiSqlSvrScript
• Get-EPiIsBulkInstalling
• Get-EPiWebApp
• Get-EPiWebServer
• Get-EPiVersion
• Get-EPiVersionPath
• Get-EPiXmlNodeExists
• Move-EPiDirectory
• Move-EPiFile
• New-EPiDirectory
• New-EPiSqlSvrDB
• New-EPiWebApp
• Remove-EPiDirectory
• Remove-EPiFiles
• Remove-EPiSqlSvrDB
• Remove-EPiSqlSvrUser
• Remove-EPiWebApp
• Remove-EPiXmlNode
• Set-EPiAccess
• Set-EPiBuiltInPageTypePaths
• Set-EPiProgressStatus
• Set-EPiXmlAttribute
• Unload-EPiSite
• Update-EPiXmlFile

EPiServer CMS R2 SP1 Cmdlets

The following is a list of Cmdlets implemented in the EPiServer.Install.CMS.xx.xx.xx.xx snap-in:
• Add-EPiServerData
• Get-EPiCMSVersion
• Get-EPiCMSVersionPath
• New-EPiCMSWizard
• Set-EPiBuiltInPageTypePaths