Solved

Unable to run a power shell scripts

Posted on 2013-01-18
4
943 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
4 Comments
 
LVL 18

Assisted Solution

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

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 16

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now