Powershell error : “.ps1 cannot be loaded because the execution of scripts is disabled on this system”

When You are trying to run a PS1 script in Power shell you are getting the following error:

“File C:\scripts\.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see “get-

help about_signing” for more details.

At line:1 char:19

+ c:\scripts\.ps1 <<<<”

 

 

 

 

 

 

 

The security settings built into Windows PowerShell include something called the “execution policy;” the execution policy determines how (or if) PowerShell runs scripts. By default, PowerShell’s execution policy is set to Restricted; that means that scripts – including those you write yourself – won’t run.

You can see it by runnig to command: Get- ExecutionPolicy

As you can see , Its restricted

 

 

 

 

 

For enabling it just run :

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Now you can run your PS1 script

*Note: the unrestricted option will allow  All scripts from all sources can be run without signing

A safer option will be tp run

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned


About Idit Bnaya

Sr. Cloud Solution Architect at Microsoft, I’m passionate about helping customers succeed by building secure, scalable, and innovative cloud solutions – with a strong focus on AI, DevOps practices, and end-to-end security. With a proven track record in the IT and services industry, I serve as a trusted advisor, partnering closely with organizations to guide them through digital transformation and maximize the value of their cloud investments. My role combines technical leadership with project ownership – from designing modern architectures to leading cross-functional implementations that drive real business outcomes. I also manage and empower strategic partners, working hand-in-hand with them to ensure project success and deliver measurable business impact for customers.
This entry was posted in PowerShell, Windows and tagged , . Bookmark the permalink.

Leave a Reply