In the last article, Starting with Sitecore PowerShell, we described how to install the SPE module and what its possibilities are. In this article, I will describe how to run PowerShell commands without the need to be signed in to Sitecore interfaces. This possibility of running scripts is mainly advantageous when performing actions via scheduled tasks or via external tools, which is performed by the deploy application on the servers. It is also advantageous to use manual running of scripts via the console.

Running Scripts

PowerShell scripts can be run in Windows either using the program PowerShell Console or in Windows PowerShell ISE. I recommend using Windows PowerShell ISE because it is more comfortable to with during development.

Installation of Module

Source libraries can be found on GitHub. After downloading and opening the file, copy the newest SPE Remoting module possible into the PowerShell module folder. The default folder for PowerShell modules Windows can be found in the following path: c:\Users\{user name}\Documents\WindowsPowerShell\Modules\. If you choose your own folder in your own project, you will have to specify the complete path to the module in your code.

Verification of Functionalities

Verify the proper installation and functionality of the module using the following code. The code assumes the placement of the module in the Windows default folder.

Import-Module SPE
Get-Command -Module SPE

By running the previous code, you should get the output, see Figure.


Practical Use

The SPE module contains several commands. For running any command on the selected Sitecore instance, apply the following example:

Import-Module SPE

$session = New-ScriptSession -Username admin -Password b -ConnectionUri "http://{Sitecore domain}"
Invoke-RemoteScript -Session $session -ScriptBlock { Get-User -Id admin}

The result will be the loading of the information about the “admin“ user.



Immediately when you start running Sitecore PowerShell externally via this module, new maintenance and Sitecore administration possibilities become available to you. The uses are for example endless in combination with using remote running on any server in the infrastructure. Good luck 🙂