Powershell Extensions Remote

Getting started

With Powershell Extensions for Sitecore you can run Powershell scripts in Sitecore. Also SXA is offering a bunch of Scripts supporting your activities. I recently had to run Powershell remotely. There is good Documentation out there but somehow I missed some pieces that stopped me from using that feature smoothly. So I try to connect the pieces of the puzzle in this blog post.

1.  Watch Tutorial Video

There is a very good Introduction Video by Michael West that gives you a step by step introduction to run PSE remote. https://www.youtube.com/watch?v=fGvT8eDdWrg

2. Download Zip

But when I tried to reproduce the steps from the video I failed to find the mentioned zip files. They can be found here: https://github.com/SitecorePowerShell/Console/releases/ Make sure you run download the version that corresponds to your installed PSE Version.

3. Extract Page and copy it to right location

  1. Go into documents directory
  2. Create a folder called "WindowsPowerShell" (if not existend)
  3. Create a folder called "Modules" (if not existend)
  4. Put extracted SPE folder into "Modules" Folder

4. Import Module

  1. Open Powershell Console
  2. Run: Import-Module -Name SPE
  3. Specify the module name: Get-Command -Module SPE

5. Patch your Sitecore configs

By default Sitecore does not allow remote access with PSE. This has to be configured in the Security Configs.

Here you find a good documentation about it: https://doc.sitecorepowershell.com/security#configure-web-services

If you scroll to the bottom of the page you'll find a link to a "ShieldsDown" configuration that is only meant to be used locally.

https://alan-null.github.io/2017/01/spe-dev-config

 

Place this config in your include folder and make sure it's read last.

6. Interact with Sitecore remotely

Sample Script:

Import-Module -Name SPE

$session = New-ScriptSession -Username admin -Password b -ConnectionUri "http://sxa92.dev.local"

Invoke-RemoteScript -Session $session -ScriptBlock { Get-User -Id admin } | Get-Member

 

 

Official Documentation about remote powershell extensions you can find here: https://doc.sitecorepowershell.com/remoting

 

 

 

 

Created: 25.2.2020

Powershell SXA