Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 956
  • Last Modified:

Unable to run a power shell scripts

Hi,

I am running Windows 8. In Windows Power shell ISE , I had set the Execution policy to RemoteSigned. but if I run the power shell script,i am getting the following message.

Hello : File C:\Power_Shell-Scripts\Hello.ps1 cannot be loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Hello
+ ~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
0
sivakugan
Asked:
sivakugan
4 Solutions
 
Raheman M. AbdulCommented:
Try
set-executionpolicy unrestricted
0
 
becraigCommented:
Is the script remote-signed  ?

        RemoteSigned
            - Scripts can run.

            - Requires a digital signature from a trusted
              publisher on scripts
and configuration files that
              are downloaded from the Internet (including
              e-mail and instant messaging programs).

What you need for your script might be to set-execution policy bypass as a part of your script
0
 
Prashant GirennavarCommented:
You need to see what is the excution policy set.

Open the powershell console and type

Get-ExecutionPolicy

If it comes as Restricted,

Make it as REMOTESIGNED.

To do that,

Run below command in Powershell console( Open the console with Administrator privilages)

Set-Executionpolicy RemoteSigned.

Say "Yes" for confirmation.

Hope this helps

Thanks,

_Prashant_
0
 
LearnctxEngineerCommented:
Also remember that Powershell 32-bit and 64-bit have separate execution policies. So set them in both environments (Powershell and Powershell (x86)). You can also set the execution policy when launching Powershell:

powershell.exe -executionpolicy unrestricted
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now