PowerShell for EPiServer Applications

Product version:

EPiServer CMS 6 / 6 R2

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, for example, “Get”, “Set”, “New”, “Delete” etc. The noun describes what the verbs acts upon, for example, “File”, “Site” etc.
See PowerShell Managed Reference on MSDN for more details of Cmdlets.

Snap-ins

A PowerShell snap-in is a managed .NET assembly that plays hosts to special classes called Cmdlets. A cmdlet class derives from one of the Microsoft base classes (Cmdlet or PSCmdlet) and provides a function which is callable from PowerShell using a noun and verb. The noun and the verb together product the function name, for example, Get-EPiWebApp. More detailed information can be found about PowerShell snap-ins and cmdlets in the Windows PowerShell Programmer's Guide.

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 (for example 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 currently provides the following PowerShell snap-ins:

  • The EPiServer.Install.Common.1 snap-in is shipped with all EPiServer products. This provides the cmdlets to manage and deploy EPiServer product entities. Each product can only conatin one snap-in, so when upgradin the old snap-in is overwritten by the new one.
  • The EPiServer.Install.CMS.X.X.XXX.XX (exact version) snap-in is shipped with EPiServer CMS. This provides the cmdlets to manage and deploy EPiServer CMS specific entities.
  • (The EPiServer.Install.SnapIn.X.X.XXX.XX snap-in was used to provide the cmdlets to manage and deploy entities. It was shipped in earlier versions of EPiServer CMS, but is not used anymore.)

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 CMS Snap-in

EPiServer CMS also has its own PowerShell snap-in to provide access the CMS specific parts of the EPiServer Install API. The snap-in name is EPiServer.Install.CMS.X.X.X.X where X.X.X.X is the verision of CMS for which the snap-in was created.