Compass ProSolution 9.2 PowerShell Task Error

General

After the upgrade to ProSolution 9.2, I found that the tasks we ran which used PowerShell with the ProSolution Worker Service failed with the following error message:

Error:  – System.Management.Automation.Runspaces.PSSnapInException: An error occurred when loading the system Windows PowerShell Snap-Ins. Please contact Microsoft Support Services. —> System.Management.Automation.PSArgumentException: Unable to access Windows PowerShell PowerShellEngine registry information.

   at System.Management.Automation.PSSnapInReader.GetPSEngineKey(String psVersion)

   at System.Management.Automation.PSSnapInReader.ReadRegistryInfo(Version& assemblyVersion, String& publicKeyToken, String& culture, String& architecture, String& applicationBase, Version& psVersion)

   at System.Management.Automation.PSSnapInReader.ReadEnginePSSnapIns()

   at System.Management.Automation.Runspaces.MshConsoleInfo.CreateDefaultConfiguration()

   — End of inner exception stack trace —

   at System.Management.Automation.Runspaces.MshConsoleInfo.CreateDefaultConfiguration()

   at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.CreateDefaultConfiguration()

   at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(PSHost host)

   at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()

   at CompassCC.CCCSystem.CCCWindowsService.CCCScriptExecutor.CreateOpenDefaultRunSpace()

   at CompassCC.CCCSystem.CCCWindowsService.CCCScriptExecutor.ExecutePowerShellScript(String strScript)

The first thought was a dodgy script, so I checked and made a test script containing something simple like changing directory, but even this failed, with the same error as shown above. I could run the script manually from the PowerShell prompt on the server so I knew that PowerShell was working fine on the server.

It appeared that the problem was to do with Powershell 3.0 not being installed, after installing PowerShell 3.0 onto the server from: http://www.microsoft.com/en-us/download/details.aspx?id=34595

Windows Server 2008 R2 SP1 64-bit versions: Windows6.1-KB2506143-x64.msu

Then reboot the server to complete the installation.

Now to verify that the PowerShell version is correct run the following commands from a PowerShell console:

PS H:\> Set-Location variable:

PS H:\> Get-ChildItem

Then to show the version:

PS H:\> $Host.Version

Now once this was done I testing running the tasks from within ProSolution and they worked fine.