Member Avatar for HTMLperson5

Well, as you might know, when you are attempting to run a script from poweshell and have not used:

Get-ExecutionPolicy

You will get

File C:\scripts\test.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-
help about_signing" for more details.
At line:1 char:19
+ c:\scripts\test.ps1 <<<<

So i did use this get-executionpolicy thing at the end. And i got a lovely message from the console:

Restricted

So i tried

Set-ExecutionPolicy RemoteSigned

But then from the console i got another message:

Get-ExecutionPolicy : Cannot bind parameter 'Scope'. Cannot convert value "RemoteSigned" to type "Microsoft.PowerShell
ExecutionPolicyScope" due to invalid enumeration values. Specify one of the following enumeration values and try again
 The possible enumeration values are "Process, CurrentUser, LocalMachine, UserPolicy, MachinePolicy".
At line:1 char:20
+ Get-ExecutionPolicy <<<<  RemoteSigned
    + CategoryInfo          : InvalidArgument: (:) [Get-ExecutionPolicy], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetExecutionPolicyCommand

What am i supposed to do!?

Hello,

I ran into the same thing and here is what you need:
set-executionpolicy remotesigned

Open up a command shell and run that line and you will be able to execute scripts locally without them being signed.

Member Avatar for HTMLperson5

I ran into the same thing and here is what you need:
set-executionpolicy remotesigned

I have tried that:

So i tried
Set-ExecutionPolicy RemoteSigned

Member Avatar for HTMLperson5

Sorry, let me be a bit more specific.
This is what I did, (error details included):

PS C:\Users\HTMLperson5> set-executionpolicy remotesigned

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y


Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft
.PowerShell' is denied.
At line:1 char:20
+ set-executionpolicy <<<<  remotesigned
    + CategoryInfo          : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyComma
   nd

What do I do?

Member Avatar for HTMLperson5

I have also tried running this command through the Administrator account, still I got the same result.

If you are running Powerwshell on a Windows 7 machine, you need to run Powershell as an administrator. On your Powershell shortcut (or START-RUN then type Powershell and wait for it to appear in the search results) right-click and select Run as administrator. This will give you permission to write the registry key. I have seen many recommendations to always run Powershell in elevated mode, and I always do since I use Powershell to administer systems, AD, and such.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.