{"id":250,"date":"2013-04-10T14:05:00","date_gmt":"2013-04-10T14:05:00","guid":{"rendered":"https:\/\/www.geekmungus.co.uk\/?p=250"},"modified":"2022-11-05T10:53:19","modified_gmt":"2022-11-05T10:53:19","slug":"compass-prosolution-9-2-powershell-task-error","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=250","title":{"rendered":"Compass ProSolution 9.2 PowerShell Task Error"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Error:&nbsp; &#8211; System.Management.Automation.Runspaces.PSSnapInException: An error occurred when loading the system Windows PowerShell Snap-Ins. Please contact Microsoft Support Services. &#8212;&gt; System.Management.Automation.PSArgumentException: Unable to access Windows PowerShell PowerShellEngine registry information.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.PSSnapInReader.GetPSEngineKey(String psVersion)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.PSSnapInReader.ReadRegistryInfo(Version&amp; assemblyVersion, String&amp; publicKeyToken, String&amp; culture, String&amp; architecture, String&amp; applicationBase, Version&amp; psVersion)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.PSSnapInReader.ReadEnginePSSnapIns()<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.Runspaces.MshConsoleInfo.CreateDefaultConfiguration()<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;&#8212; End of inner exception stack trace &#8212;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.Runspaces.MshConsoleInfo.CreateDefaultConfiguration()<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.CreateDefaultConfiguration()<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(PSHost host)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at CompassCC.CCCSystem.CCCWindowsService.CCCScriptExecutor.CreateOpenDefaultRunSpace()<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;at CompassCC.CCCSystem.CCCWindowsService.CCCScriptExecutor.ExecutePowerShellScript(String strScript)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It appeared that the problem was to do with Powershell 3.0 not being installed, after installing PowerShell 3.0 onto the server from: <a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=34595\">http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=34595<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Windows Server 2008 R2 SP1 64-bit versions: <strong>Windows6.1-KB2506143-x64.msu<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then reboot the server to complete the installation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now to verify that the PowerShell version is correct run the following commands from a PowerShell console:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PS H:\\&gt; <strong>Set-Location variable:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PS H:\\&gt; <strong>Get-ChildItem<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then to show the version:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PS H:\\&gt; <strong>$Host.Version<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now once this was done I testing running the tasks from within ProSolution and they worked fine.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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:&nbsp; &#8211; System.Management.Automation.Runspaces.PSSnapInException: An error occurred when loading the system Windows PowerShell Snap-Ins. Please contact Microsoft Support Services. &#8212;&gt; System.Management.Automation.PSArgumentException: Unable to access Windows PowerShell PowerShellEngine registry information. &#8230; <a title=\"Compass ProSolution 9.2 PowerShell Task Error\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=250\" aria-label=\"Read more about Compass ProSolution 9.2 PowerShell Task Error\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-250","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=250"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/250\/revisions"}],"predecessor-version":[{"id":1492,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/250\/revisions\/1492"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}