Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - "Permission Denied" when invoking PowerShell

Reply
 
Old 11-16-2006   #1 (permalink)
robw
Guest


 
 

"Permission Denied" when invoking PowerShell

I want to create a PowerShell equivilent of "cmd here", so I added the
following to the registry:

key: HKEY_CLASSES_ROOT\Directory\shell\ps
value: Open PowerShell Here

key: HKEY_CLASSES_ROOT\Directory\shell\ps\command
value: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit
-command "& {set-location %L}"

In theory, this should work. But what happens is that when I try to use it
(i.e. right-click on a folder and select "PowerShell here", I get a diaglog
box with the error message "permission denied". Any ideas how I can make
this work?

My System SpecsSystem Spec
Old 11-16-2006   #2 (permalink)
robw
Guest


 
 

RE: "Permission Denied" when invoking PowerShell

Correction: the error message is actually "Access is denied."
My System SpecsSystem Spec
Old 11-16-2006   #3 (permalink)
Rick
Guest


 
 

RE: "Permission Denied" when invoking PowerShell

Scott Hansleman did it with a inf file. Maybe that will give you a clue. I
haven't actually tried it yet.
http://www.hanselman.com/blog/Introd...romptHere.aspx

"robw" wrote:

> Correction: the error message is actually "Access is denied."

My System SpecsSystem Spec
Old 11-16-2006   #4 (permalink)
Lucvdv
Guest


 
 

Re: "Permission Denied" when invoking PowerShell

On Thu, 16 Nov 2006 06:57:02 -0800, robw <robw@discussions.microsoft.com>
wrote:

> Correction: the error message is actually "Access is denied."


It's because you're using "%SystemRoot%" instead of "C:\Windows" in the
command (I had the same thing, or I wouldn't know either

By default, the "(Default)" value of a registry key isn't a REG_EXPAND_SZ
type, it's a REG_SZ and regedit offers no way to make it anything else.



Just replace the %systemroot% manually, or if you really want to stick to
%SystemRoot% instead of using the 'hard' path, create a .reg file that sets
the value as a BINARY(2) type.

Something like this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\PowerShell\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,\

25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,69,\

00,6e,00,64,00,6f,00,77,00,73,00,50,00,6f,00,77,00,65,00,72,00,53,00,68,00,\

65,00,6c,00,6c,00,5c,00,76,00,31,00,2e,00,30,00,5c,00,70,00,6f,00,77,00,65,\
00,72,00,73,00,68,00,65,00,6c,00,6c,00,2e,00,65,00,78,00,65,00,00,00


BTW1, if you put it in the HKCR\Folder key it will work on a drive's root
directory too, instead of just subdirectories.
And on a lot more places, with varying degrees of success.

BTW2, you don't need to include the -command switch to set your location.
The fact that the app is started with the selected folder as current
directory is enough.
My System SpecsSystem Spec
Old 11-16-2006   #5 (permalink)
Lucvdv
Guest


 
 

Re: "Permission Denied" when invoking PowerShell

On Thu, 16 Nov 2006 17:04:03 +0100, Lucvdv <replace_name@null.net> wrote:

> Just replace the %systemroot% manually, or if you really want to stick to
> %SystemRoot% instead of using the 'hard' path, create a .reg file that sets
> the value as a BINARY(2) type.


I meant HEX(2)


> Something like this:
>
> Windows Registry Editor Version 5.00
>
> [HKEY_CLASSES_ROOT\Folder\shell\PowerShell\command]
> @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,\
>
> 25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,69,\
>
> 00,6e,00,64,00,6f,00,77,00,73,00,50,00,6f,00,77,00,65,00,72,00,53,00,68,00,\
>
> 65,00,6c,00,6c,00,5c,00,76,00,31,00,2e,00,30,00,5c,00,70,00,6f,00,77,00,65,\
> 00,72,00,73,00,68,00,65,00,6c,00,6c,00,2e,00,65,00,78,00,65,00,00,00


And my newsreader broke the lines here...
There should be no empty lines between.
My System SpecsSystem Spec
Old 11-16-2006   #6 (permalink)
robw
Guest


 
 

Re: "Permission Denied" when invoking PowerShell

Aha! Now all is clear. Thank you very muchly.


"Lucvdv" wrote:

> On Thu, 16 Nov 2006 06:57:02 -0800, robw <robw@discussions.microsoft.com>
> wrote:
>
> > Correction: the error message is actually "Access is denied."

>
> It's because you're using "%SystemRoot%" instead of "C:\Windows" in the
> command (I had the same thing, or I wouldn't know either
>
> By default, the "(Default)" value of a registry key isn't a REG_EXPAND_SZ
> type, it's a REG_SZ and regedit offers no way to make it anything else.
>
>
>
> Just replace the %systemroot% manually, or if you really want to stick to
> %SystemRoot% instead of using the 'hard' path, create a .reg file that sets
> the value as a BINARY(2) type.
>
> Something like this:
>
> Windows Registry Editor Version 5.00
>
> [HKEY_CLASSES_ROOT\Folder\shell\PowerShell\command]
> @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,\
>
> 25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,69,\
>
> 00,6e,00,64,00,6f,00,77,00,73,00,50,00,6f,00,77,00,65,00,72,00,53,00,68,00,\
>
> 65,00,6c,00,6c,00,5c,00,76,00,31,00,2e,00,30,00,5c,00,70,00,6f,00,77,00,65,\
> 00,72,00,73,00,68,00,65,00,6c,00,6c,00,2e,00,65,00,78,00,65,00,00,00
>
>
> BTW1, if you put it in the HKCR\Folder key it will work on a drive's root
> directory too, instead of just subdirectories.
> And on a lot more places, with varying degrees of success.
>
> BTW2, you don't need to include the -command switch to set your location.
> The fact that the app is started with the selected folder as current
> directory is enough.
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can't change permission to "full control": Access is Denied. Vista file management
"Permission Denied" error while copying files in Vista using VBScr VB Script
Registry Editing / Permission Denied even "run as administrator" Vista account administration
"Location is Not Available" -- "Access is Denied." Vista installation & setup
Re: "What's the deal with UAC (Windows Needs Your Permission screens)" and "...But I thought I was an administrator" Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46