How to Run a .ps1 File in PowerShell
PowerShell scripts — saved with the .ps1 file extension — are powerful automation tools built into Windows. But if you've ever double-clicked a .ps1 file and nothing happened, or tried to run one and hit an error, you're not alone. Running a PowerShell script isn't quite as straightforward as launching a regular program, and that's by design.
What Is a .ps1 File?
A .ps1 file is a plain-text script written in the PowerShell scripting language. It can contain anything from a single command to hundreds of lines of logic — automating backups, managing users, configuring system settings, or pulling data from APIs.
Windows doesn't run these files on double-click by default. Instead, it opens them in a text editor. This is a deliberate security measure, not a bug.
Why PowerShell Blocks Scripts by Default
PowerShell uses a setting called the Execution Policy to control whether scripts can run on a system. Out of the box, most Windows machines are set to Restricted, which blocks all .ps1 files from executing — even ones you wrote yourself.
The four most common execution policy levels are:
| Policy | What It Allows |
|---|---|
| Restricted | No scripts. Interactive commands only. |
| AllSigned | Scripts must be signed by a trusted publisher. |
| RemoteSigned | Local scripts run freely; downloaded scripts must be signed. |
| Unrestricted | All scripts run, with warnings for downloaded files. |
Most users working with their own scripts set the policy to RemoteSigned, which strikes a practical balance between usability and security.
How to Check Your Current Execution Policy
Before running any script, open PowerShell and type: