Page 1 of 1

[12.20.0207] "Run With PowerShell" Failing

Posted: 05 Mar 2013 20:55
by EnjoyRC
If I browse to a directory with Win Explorer, and right click a PS1 file, I get an option "Run With PowerShell".. and all is good.
In XY, I right click a PS1 file, I again see the "Run With PowerShell" option. But it fails.
Yes, I have set ExecutionPolicy to Unrestricted. :) Works just fine from Explorer. Any ideas?

Code: Select all

File .... cannot be loaded because the execution of the scripts is disabled on this system.  Please see "get-help about_signing" for more details.
+ CategoryInfo...
+FullyQualifiedErrorId : RuntimeException.

Re: [12.20.0207] "Run With PowerShell" Failing

Posted: 06 Mar 2013 08:36
by admin
Run XY as admin?

Re: [12.20.0207] "Run With PowerShell" Failing

Posted: 06 Mar 2013 14:31
by EnjoyRC
admin wrote:Run XY as admin?
As per your suggestion, just right clicked XYplorer and selected "Run as Administrator".
Then when trying to (right click / run with powershell) on a file, I still get the same error.

Re: [12.20.0207] "Run With PowerShell" Failing

Posted: 07 Mar 2013 07:54
by admin
And when you login as admin?

Re: [12.20.0207] "Run With PowerShell" Failing

Posted: 07 Mar 2013 14:54
by TheQwerty
I cannot say I understand exactly what is happening, but it seems like it is another x64 annoyance.

If you go into the registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\0\Command

And change the value of "(Default)" from the System32 path to a SysNative path it should work correctly in XY but seems to break WE.

I would think you should be able to get it working in both by adding entries under:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes
but I'm not having any luck with my attempts, so I might be flat out wrong.


EDIT: A kludgey fix would be to add a second "Run with Native PowerShell" command that would work in XY but not in Windows Explorer.

To do that in the registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\
  1. Create a new key; its name doesn't seem to matter but I went with "1".
  2. Under our new "1" key change the value of "(Default)" to whatever you want displayed in the context menu. I'm hungry and called mine "Taco", but "Run with Native PowerShell" might be more informative.
  3. Under the "1" key create a new key named "Command".
  4. Under "Command" change the value of "(Default)" to the SysNative version of the value of ".\0\Command\(Default)".
Now when you right click a PS1 there will be two "Run with ..." commands one that works in 64-bit programs and another that should work in 32-bit ones (though using the 64-bit PowerShell not the 32-bit one).


There is probably a better, or at least cleaner, solution, but this is the first one I stumbled upon.