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 - How to enable Power shell scripts

Reply
 
Old 03-19-2008   #1 (permalink)
Dee


 
 

How to enable Power shell scripts

I want to run some power shell scripts for tests.

I have run the command below, but I'm getting the error below.

PS C:\TEMP> Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy : Access to the registry key
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft
..PowerShell' is denied.

I am an Administrator

I checked the registry and nothing in there to allow for this option.

Its great to secure scriptiing this way, but can anyone help on how I can
get ps1 scripts to run on Vista or whats best practise on running the PS1
scripts.

D

--
Dee

My System SpecsSystem Spec
Old 03-19-2008   #2 (permalink)
Tomas Restrepo [MVP]


 
 

Re: How to enable Power shell scripts

Hi Dee
Quote:

>I want to run some power shell scripts for tests.
>
> I have run the command below, but I'm getting the error below.
>
> PS C:\TEMP> Set-ExecutionPolicy Unrestricted
> Set-ExecutionPolicy : Access to the registry key
> 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft
> .PowerShell' is denied.
>
> I am an Administrator
>
> I checked the registry and nothing in there to allow for this option.
>
> Its great to secure scriptiing this way, but can anyone help on how I can
> get ps1 scripts to run on Vista or whats best practise on running the PS1
> scripts.
'
Try opening up a powershell window with elevated privileges and running the
command again (find powershell on the start menu, right click, Run as
Administrator). That should work, I think


--
Tomas Restrepo
http://www.devdeo.com/
http://www.winterdom.com/weblog/

My System SpecsSystem Spec
Old 03-19-2008   #3 (permalink)
Marco Shaw [MVP]


 
 

Re: How to enable Power shell scripts

Dee wrote:
Quote:

> I want to run some power shell scripts for tests.
>
> I have run the command below, but I'm getting the error below.
>
> PS C:\TEMP> Set-ExecutionPolicy Unrestricted
> Set-ExecutionPolicy : Access to the registry key
> 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft
> .PowerShell' is denied.
>
> I am an Administrator
>
> I checked the registry and nothing in there to allow for this option.
>
> Its great to secure scriptiing this way, but can anyone help on how I can
> get ps1 scripts to run on Vista or whats best practise on running the PS1
> scripts.
>
> D
>
Try as Tomas mentions. Also, it is best to set the policy to
"RemoteSigned".

This way you would initially get a warning about scripts downloaded from
the Internet before being able to run them (if not signed).

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 03-20-2008   #4 (permalink)
Tomas Restrepo [MVP]


 
 

Re: How to enable Power shell scripts

Thomas,
Quote:

>
> I'd argue this point a bit.
>
> For me, this policy has no real effect - I use FireFox and it does not set
> the alternate data stream to indicate a script was downloaded from the
> internet.
<chuckle>
Quote:

> I'd argue that requiring signing of all scripts is probably safer but more
> of a PITA.
But is this realistic? I mean, is anyone writing their own custom scripts
and signing them?

Or, put it another way, how many people go around download scripts and
blindly executing them without looking at the script contents?


--
Tomas Restrepo
http://www.devdeo.com/
http://www.winterdom.com/weblog/

My System SpecsSystem Spec
Old 03-21-2008   #5 (permalink)
Keith Hill [MVP]


 
 

Re: How to enable Power shell scripts

"Tomas Restrepo [MVP]" <tomasr@xxxxxx> wrote in message
news:eSinbDpiIHA.4396@xxxxxx
Quote:

> Thomas,
Quote:

>>
>> I'd argue this point a bit.
>>
>> For me, this policy has no real effect - I use FireFox and it does not
>> set the alternate data stream to indicate a script was downloaded from
>> the internet.
>
> <chuckle>
>
Quote:

>> I'd argue that requiring signing of all scripts is probably safer but
>> more of a PITA.
>
> But is this realistic? I mean, is anyone writing their own custom scripts
> and signing them?
Uh no. It is a PITA IMO and provides no benefit for the build and test
scripts that we use in production.
Quote:

> Or, put it another way, how many people go around download scripts and
> blindly executing them without looking at the script contents?
What's that phrase Gump uses - "stupid is as stupid does". :-)

--
Keith

My System SpecsSystem Spec
Old 03-22-2008   #6 (permalink)
Dee


 
 

Re: How to enable Power shell scripts

Hi All

IT worked..

I ran powershell as Administrator, chenged the policy to remotesigned and
then the script.

Many thanks for your help and the interesting comments re the security issues.

D
--
Dee


"Keith Hill [MVP]" wrote:
Quote:

> "Tomas Restrepo [MVP]" <tomasr@xxxxxx> wrote in message
> news:eSinbDpiIHA.4396@xxxxxx
Quote:

> > Thomas,
Quote:

> >>
> >> I'd argue this point a bit.
> >>
> >> For me, this policy has no real effect - I use FireFox and it does not
> >> set the alternate data stream to indicate a script was downloaded from
> >> the internet.
> >
> > <chuckle>
> >
Quote:

> >> I'd argue that requiring signing of all scripts is probably safer but
> >> more of a PITA.
> >
> > But is this realistic? I mean, is anyone writing their own custom scripts
> > and signing them?
>
> Uh no. It is a PITA IMO and provides no benefit for the build and test
> scripts that we use in production.
>
Quote:

> > Or, put it another way, how many people go around download scripts and
> > blindly executing them without looking at the script contents?
>
> What's that phrase Gump uses - "stupid is as stupid does". :-)
>
> --
> Keith
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Power Shell? PowerShell
power shell in a script PowerShell
Executing Power Shell Scripts from Windows Shell PowerShell
ps scripting newbie - how to make functions/scripts available in the shell? PowerShell
power shell in x64 PowerShell


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