What Is a .PS1 File? (.ps1, .psm1, .psd1)
A .ps1 file is a PowerShell script, the file extension Microsoft uses for scripts written in its PowerShell command-line language. It contains plain text commands that automate Windows and server administration tasks. Double-clicking a .ps1 opens it in Notepad rather than running it, a deliberate safety measure.
- Extension
- .ps1, .psm1, .psd1
- Full name
- Windows PowerShell Script
- Type
- Code and web file
- Developed by
- Microsoft
About PS1 files
PowerShell scripts can manage files, the registry, users, network settings, Microsoft 365 and Azure, which makes them the main automation tool for Windows administrators. Related extensions are .psm1 for script modules, which package reusable functions, and .psd1 for module manifests and data files. Windows ships with Windows PowerShell 5.1; the newer cross-platform PowerShell 7 also runs .ps1 scripts on macOS and Linux.
By design, a .ps1 file does not run when double-clicked; it opens in Notepad. In addition, the default execution policy on Windows client PCs is Restricted, which blocks scripts entirely until an administrator or user changes it, for example with Set-ExecutionPolicy RemoteSigned -Scope CurrentUser. RemoteSigned lets local scripts run but requires downloaded ones to be signed.
Treat any .ps1 you did not write with suspicion. PowerShell has full access to your system, and malicious scripts are a common way to install ransomware and steal credentials, often disguised in ZIP attachments or in instructions telling you to paste a command. Read the script, check its source, and never bypass the execution policy because a website or email tells you to.
What PS1 files are used for
- Automating Windows setup and maintenance tasks
- Managing users and settings in Active Directory, Microsoft 365 and Azure
- Deployment and build scripts in software projects
- Scheduled jobs run by Task Scheduler
How to open a .ps1 file
Windows
Double-click to read it in Notepad, or open it in VS Code with the PowerShell extension. To run it, right-click and choose Run with PowerShell, or run .\script.ps1 in a PowerShell window.
Mac
Read it in TextEdit or VS Code. To run it, install PowerShell 7 from Microsoft and run pwsh ./script.ps1; Windows-specific commands will not work.
Linux
Install PowerShell 7 and run pwsh ./script.ps1, or view the source in any text editor.
How to convert a .ps1 file
PowerShell scripts are usually not converted. If you need a double-clickable launcher, create a .bat or shortcut that calls powershell.exe -File script.ps1 with the parameters you need.
To check a script without running its actions, read it in VS Code; many well-written administrative scripts support a -WhatIf parameter that previews changes.
Renaming .ps1 to .txt is a safe way to share a script for review by email, since some mail systems block .ps1 attachments.
Changing the extension in the file name does not convert the file. See how to change a file extension for when renaming is safe.
Naming and renaming PS1 files
- Follow PowerShell's Verb-Noun convention (Get-DiskReport.ps1, Remove-OldLogs.ps1) using approved verbs, so the purpose is obvious and matches cmdlet style.
- Avoid spaces in script names; they force quoting and a leading & when running the script from the console.
- Keep a module's .psm1 and .psd1 files named the same as their folder, because PowerShell's module loader expects that structure.
Renaming lots of .ps1 files? Use the free online bulk renamer for patterns and numbering, or try File Renamer AI to name each file from what is inside it.
Related file types
A .py file is a Python script: a plain text file of Python source code that the Python interpreter runs. It is used for automation, data analysis, web back ends, machine learning and teaching. You can open and read any .py file in a text editor, but running one requires Python to be installed.
A .js file is a JavaScript source code file. Websites load JS files to add interactivity, and Node.js runs them as programs and tools on servers and computers. It is plain text you can read in any editor. Be careful: on Windows, double-clicking a .js file can run it as a script.
A .exe file is a Windows executable: a compiled program that runs when you open it. Installers, apps and games on Windows are EXE files. Because running one gives it the same access to your computer that you have, only open EXE files from sources you trust. Macs, iPhones and Android cannot run them natively.
A .txt file is a plain text file: just characters, with no fonts, bold, images or layout. It is the simplest and most portable document format, readable by every operating system and text editor, and used for notes, logs, README files, configuration and data that needs to stay readable for decades.
Frequently Asked Questions
What is the PowerShell script file extension?
PowerShell scripts use .ps1. Modules use .psm1, and module manifests and data files use .psd1.
Why does my .ps1 file open in Notepad?
Windows associates .ps1 with Notepad on purpose so scripts are not run accidentally. Right-click and choose Run with PowerShell, or run it from a PowerShell window.
Why do I get "running scripts is disabled on this system"?
The execution policy is Restricted. If you trust the script, run Set-ExecutionPolicy RemoteSigned -Scope CurrentUser, which still blocks unsigned downloaded scripts.
Is it safe to run a .ps1 file from the internet?
Only if you trust the source and have read the code. PowerShell scripts can change system settings, download files and access your data.