Solved

Unable to run a power shell scripts

Posted on 2013-01-18
4
952 Views
Last Modified: 2013-02-07
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
Comment
Question by:sivakugan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Assisted Solution

by:Raheman M. Abdul
Raheman M. Abdul earned 100 total points
ID: 38795502
Try
set-executionpolicy unrestricted
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 100 total points
ID: 38795505
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
 
LVL 10

Accepted Solution

by:
Prashant Girennavar earned 200 total points
ID: 38795728
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
 
LVL 17

Assisted Solution

by:Learnctx
Learnctx earned 100 total points
ID: 38798245
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question