12 February,2011 by Tom Collins
When you attempt to execute a Powershell script you may see something like the following error message:
File C:\general.ps1 cannot be loaded because the execution of scripts is di
sabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:14
+ ./general.ps1 <<<< -inputfile "create_sql2008.sql"
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
This means the Execution Policy is not set with appropriate permissions.
The Execution Policy defines the level of restriction on Powershell script execution.
The 4 levels possible are:
All Signed - (Script must be signed by a trusted publisher)
Remote Signed - (Scripts downloaded scripts must be signed by a trusted publisher)
Unrestricted – (All scripts can be run)
Restricted – (Can’t run any any scripts.Interactive mode)
To check your current level use Get-ExecutionPolicy :
PS> Get-ExecutionPolicy
All signed
PS>
To change your policy use Set-ExecutionPolicy such as. Be careful which Policy you choose :
Set-ExecutionPolicy RemoteSigned
Source:Jack Vamvas (http://www.sqlserver-dba.com)
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |