This project is read-only.

Running Orchard PowerShell

After you run OrchardPs.exe from the Orchard.Web\bin folder of your Orchard instance, a PowerShell console window will appear. After a few seconds OrchardPs completes its initialization and displays a brief welcome and help message.

                    Welcome to Orchard PowerShell!

To get a list of all Orchard-related cmdlets, type Get-OrchardPsCommand -All.
To get a list of all supported cmdlets for the current location type Get-OrchardPsCommand.
To get help about a specific cmdlet, type Get-Help CommandName.
To get more help about the Orchard PowerShell provider, type Get-Help Orchard.

Navigating the Orchard Drive

Orchard PowerShell is based on a special PowerShell drive, named Orchard:, which is automatically created for you by OrchardPs. The drive exposes the data of your Orchard instance as a virtual file system, which you can navigate using normal PowerShell commands, such as Get-ChildItem (ls), Set-Location (cd), etc. By default, OrchardPs places you at the root of the Orchard drive, however, you can navigate to all other drives (for example the file system). To return to the Orchard drive, use the command:

cd Orchard:
The Orchard PowerShell drive is hierarchical, just like a regular file system drive. You view the contents of the drive using the Get-ChildItem cmdlet (or any alias such as dir or ls).

The root drive contains a directory called Tenants, which contains a subdirectory for each tenant in the Orchard instance. Each of these subdirectories contains the data for each tenant. Currently Tenants is the only root directory, however, in the future the root drive may contain other nodes which expose global data shared by all tenants.

The default Orchard tenant is represented by the Orchard:\Tenants\Default directory. You can view its content by using the command:

ls Orchard:\Tenants\Default

Discovering Orchard cmdlets

Besides the Orchard drive, the OrchardPs utility exposes cmdlets which are implemented in the core Orchard PowerShell provider and Orchard modules. You can view all Orchard-related cmdlets using the command:

Get-OrchardPsCommand -All
To get help about a specific command, use the Get-Help command name command.

Orchard cmdlets are usually associated with the directories and items exposed in the Orchard drive. For example, most commands are executed by default on the tenant represented by the current location in the Orchard drive. For example, if you current location is Orchard:\Tenants\Default, then the cmdlet will be executed on the Default tenant (most commands lets you override this behavior by specifying an additional parameter).

You can find out what cmdlets are supported on the child items of the current location in the Orchard drive, by using the Get-OrchardPsCommand cmdlet. For example to find out what cmdlets can be used with Orchard features, you can use the following commands:

cd Orchard:\Tenants\Default\Features

Last edited Jun 9, 2014 at 11:12 AM by MpDzik, version 5


No comments yet.