What a PS1 file actually is
A PS1 file is a PowerShell script — a text file containing commands that tell Windows what to do. PowerShell is a command-line tool built into Windows that can automate tasks, change settings, or run programs. When someone sends you a PS1 file, they are sending you a set of instructions written in PowerShell's language.
The ".ps1" extension is just a label that tells your computer "this is a PowerShell script." Opening it in Notepad shows you the actual commands inside. Running it means letting PowerShell read those commands and carry them out.
This matters because PS1 files can do powerful things — they can install software, delete files, change your network settings, or access your personal data. Unlike a document you read, a script is a set of instructions your computer executes. You should only run a PS1 file if you trust where it came from.
Key Takeaways
- PS1 files are PowerShell scripts that contain commands; running one means your computer will follow those instructions automatically.
- Windows blocks PS1 files from running by default for safety reasons, so you may need to change a setting called the execution policy first.
- You can read what a PS1 file does by opening it in Notepad before you run it, so you know what commands it will execute.
- Only run PS1 files from sources you trust, because they can change settings, install programs, or access files on your computer.
Why Windows stops PS1 files from running
By default, Windows does not allow PS1 files to run. If you double-click one, nothing happens. This is a safety feature called the execution policy. Microsoft set it this way because a malicious script could damage your system or steal information.
The execution policy is not a permission you grant to a single file — it is a system-wide setting that controls whether PowerShell scripts can run at all. To run any PS1 file, you first have to change this setting. The change is permanent until you change it again.
There are different execution policy levels. The most common ones are "Restricted" (scripts do not run), "RemoteSigned" (scripts you read must be signed by a trusted publisher, but local scripts can run), and "Unrestricted" (any script runs). Most people use RemoteSigned as a middle ground.
How to check your current execution policy
Before you change anything, you can see what your current setting is. Open PowerShell by pressing the Windows key, typing "PowerShell," and clicking "Windows PowerShell" or "PowerShell" (not "PowerShell ISE"). Right-click it and select "Run as administrator" — you need admin rights to check or change the policy.
In the PowerShell window, type this command and press Enter:
Get-ExecutionPolicy
PowerShell will show you the current policy. If it says "Restricted," PS1 files cannot run. If it says "RemoteSigned" or "Unrestricted," they can. Write down what you see — you may want to change it back later.
How to change the execution policy to run PS1 files
If your execution policy is "Restricted," you need to change it. Open PowerShell as administrator again (Windows key, type "PowerShell," right-click, "Run as administrator"). Type this command and press Enter:
Set-ExecutionPolicy RemoteSigned
PowerShell will ask you to confirm. Type "Y" and press Enter. The policy is now changed. You can now run PS1 files that are stored on your computer or created locally. Files downloaded from the internet will still be blocked unless they are signed by a trusted publisher — which is an extra layer of safety.
If you want to allow all scripts to run with no restrictions, use "Unrestricted" instead of "RemoteSigned" in the command above. This is less safe, so only do it if you are certain the scripts you plan to run are trustworthy.
How to actually run a PS1 file
Once you have changed the execution policy, you can run a PS1 file. The safest way is to open PowerShell as administrator, navigate to the folder where the file is stored, and run it from there.
Open PowerShell as administrator. Type "cd" followed by the path to the folder. For example, if your file is on your Desktop, type:
cd C:\Users\YourUsername\Desktop
Replace "YourUsername" with your actual Windows username. Press Enter. Now type the name of the PS1 file with a dot and backslash before it:
.\filename.ps1
Replace "filename" with the actual name of your file. Press Enter. PowerShell will run the script and show you the results or any messages the script produces.
Do not double-click a PS1 file to run it, even after changing the execution policy. Running it from PowerShell gives you more control and lets you see what happens as it runs.
How to read a PS1 file before running it
Before you run any PS1 file, open it in Notepad to see what commands it contains. Right-click the PS1 file, select "Open with," and choose "Notepad." You will see the actual PowerShell commands inside.
You do not need to understand every line, but you can look for obvious things: Does it mention programs you recognize? Does it reference folders or files you care about? Does it mention downloading something from the internet? If the file is very short and straightforward, that is usually a good sign. If it is long and complex, or if it mentions things you do not recognize, ask someone you trust before running it.
If you see commands like "Remove-Item" (deletes files), "Set-ItemProperty" (changes settings), or URLs you do not recognize, be cautious. These are not automatically dangerous — legitimate scripts use them too — but they are worth understanding before you run the script.
Changing the execution policy back if you want to
If you changed your execution policy and later want to set it back to "Restricted," you can. Open PowerShell as administrator and type:
Set-ExecutionPolicy Restricted
Confirm with "Y" and press Enter. PS1 files will no longer run. You can change it back and forth as many times as you need — there is no penalty for doing so.
Many people leave it set to "RemoteSigned" permanently because it is a reasonable balance: local scripts run, but downloaded scripts have an extra check. If you run PS1 files regularly, leaving it at RemoteSigned is practical. If you rarely run them, setting it back to Restricted after you are done adds a small extra layer of safety.
Frequently Asked Questions
What happens if I run a PS1 file I do not trust?
It depends on what the script does. A malicious script could delete files, install unwanted software, steal passwords, or change your system settings. This is why you should only run PS1 files from sources you trust — friends, colleagues, official websites, or reputable software companies. If someone sends you a PS1 file unexpectedly, ask them why before you run it.
Can I run a PS1 file on a Mac or Linux computer?
PowerShell exists for Mac and Linux, but it is not installed by default. You would need to read and install it first. Most PS1 files are written for Windows, so they may not work correctly on other systems. If you need to run a script on a Mac or Linux, ask the person who created it whether they have a version for your operating system.
Why does my PS1 file not run even after I changed the execution policy?
The most common reason is that you did not open PowerShell as administrator. The execution policy change requires admin rights. Open PowerShell, right-click it, and select "Run as administrator" before you change the policy. Also make sure you typed the command correctly — PowerShell is case-insensitive, but spelling matters.
Is it safe to set the execution policy to Unrestricted?
It is less safe than RemoteSigned, but it is not dangerous if you are careful about which PS1 files you run. Unrestricted means any script can run without any checks. If you use it, be extra cautious about where your PS1 files come from. Most people do not need Unrestricted — RemoteSigned is safer and still lets you run the scripts you need.
Can I undo what a PS1 file did after I run it?
It depends on what the script did. If it installed a program, you can uninstall it. If it changed settings, you may be able to change them back manually. If it deleted files, recovery is harder — deleted files go to the Recycle Bin first, but if they are emptied from there, recovery requires special tools. This is another reason to read a PS1 file before running it and to only run scripts from sources you trust.