Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unable to run a power shell scripts

Posted on 2013-01-18
4
Medium Priority
?
955 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 400 total points
ID: 38795502
Try
set-executionpolicy unrestricted
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 400 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 800 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 400 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

Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
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 count occurrences of each item in an array.

721 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