(click to expand)
What is PowerShell?
PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Linux, Mac OS, and Windows.
Why use PowerShell?
- It's powerful - fully control your computer.
- It's easy to learn - see the tutorial at: https://www.guru99.com/powershell-tutorial.html.
- It's cross-platform - available for Linux, Mac OS and Windows.
- It's open-source and free - see the Github repository at: https://github.com/PowerShell/PowerShell.
- It's fully documented - see the official documentation at: https://docs.microsoft.com/en-us/powershell.
- It supports modern features such as Unicode, metadata header, try-catch-blocks, and many more.
How to learn PowerShell?
- Please find tutorials at: https://www.guru99.com/powershell-tutorial.html
- See a cheat sheet at: PowerShell/Docs/cheat-sheet.md
- Visit the official PowerShell documentation at: https://docs.microsoft.com/en-us/powershell/
How to install PowerShell on Linux?
- Your Linux supports Snap packages? Then execute:
$ sudo snap install PowerShell
$ sudo ln -s /snap/bin/pwsh /usr/bin/pwsh
- Otherwise, visit: https://github.com/PowerShell/PowerShell and scroll down to: Get PowerShell.
- Want to set PowerShell as your default shell?
- Make sure the file /etc/shells (contains valid login shells) has a /usr/bin/pwsh line, otherwise add it.
- Now execute:
chsh -s /usr/bin/pwsh <USERNAME>(replace <USERNAME> by your user name).
- SSH login is too verbose?
- Just execute:
echo > ~/.hushlogin
- Just execute:
How to install PowerShell on MacOS?
Please visit: https://github.com/PowerShell/PowerShell and scroll down to: 'Get PowerShell'.
How to install PowerShell on Windows?
Good news: It's preinstalled, but not enabled yet (script execution policy is restricted). To change this: open Windows PowerShell (Admin) console and enter:
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
NOTE: the group policy object (GPO) settings of your organization might disallow changes. In that case contact your system administrator for help.
Which PowerShell version to use?
- PowerShell up to 2.0 is out-dated and will be removed in newer Windows releases.
- PowerShell 5.1 is preinstalled on Windows 10 or 11.
- PowerShell 7.5.4 is the very latest (as of December 2025), but needs to be installed manually.
- See also the version history at: https://github.com/PowerShell/PowerShell/releases
- Scripts should specify the required version, e.g.:
#Requires -Version 5(it also helps to identify out-dated scripts).
How to safely use PowerShell scripts?
- DO NOT execute scripts or executables from untrusted sources! Watch out for fake profiles!
- CHECK the script content prior execution.
- Prefer SSH Remoting instead of PowerShell Remoting
- More recommendations by NSA and cyber security centers in the U.S. (CISA), New Zealand (NZ NCSC), and the U.K. (NCSC-UK) can be found here: https://media.defense.gov/2022/Jun/22/2003021689/-1/-1/1/CSI_KEEPING_POWERSHELL_SECURITY_MEASURES_TO_USE_AND_EMBRACE_20220622.PDF
How to get the 600+ PowerShell scripts?
- When using Git, execute in a terminal window:
git clone https://github.com/fleschutz/PowerShell - Otherwise, download and unzip it from: https://github.com/fleschutz/PowerShell/archive/master.zip
How to execute PowerShell scripts?
- In the Windows desktop: right-click the script and select: Execute with PowerShell
- On the command-line (CLI): launch a terminal application (e.g. Windows Terminal), then type:
cd <PATH>, then:./<SCRIPT-NAME>.ps1. - By remote login: use SSH to login to the remote machine, then type:
cd <PATH>, then:./<SCRIPT-NAME>.ps1. - By context menu: see below.
- By voice commands: see repo talk2windows for more information.
- By GUI: see gui/README.md for more information.
- By automation software: see Jenkins.io or AutoHotKey.com for more information.
- Automatically on login: see below.
How to execute PowerShell scripts in Windows context menus?
How to execute PowerShell scripts automatically on login in Windows?
- Open the File Explorer with your Autostart folder (usually at:
C:\Users\YOUR_USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup). - Copy the script (or a link to it) into this folder.
How to execute PowerShell scripts in Jenkins?
- Install the Jenkins plugin "PowerShell plugin" from https://plugins.jenkins.io/ (the plugin uses PowerShell.exe on Windows and pwsh on Linux).
- Add or reference your PowerShell scripts in the Jenkins jobs or in your Jenkinsfiles.
How to get the ultimate PowerShell experience? (Pro tip)
- Install PowerShell (free) on all your Linux/Mac OS/Windows machines and configure it as your default shell.
- Install SSH client & server (free) on all your Linux/Mac OS/Windows machines for remote control via SSH.
- Install this PowerShell repo and set the PATH environment variable to the 📂scripts subfolder with 600+ scripts.
- Install Windows Terminal (free) on Windows with 80% transparency, font 'Fira Code' and no PowerShell banner message.
- Install Visual Studio Code (free) with plugin 'PowerShell' to edit your PowerShell scripts.
- Set an own PowerShell profile by executing:
./update-powershell-profile.ps1 - Install Jenkins (free) together with the PowerShell plugin and use PowerShell scripts in your Jenkins jobs.
Why do some scripts show gibberish characters?
Your current terminal application doesn't support Unicode characters used by those PowerShell scripts.
Use a modern one such as Windows Terminal, please.
How to set a custom PowerShell profile?
Execute: ./update-powershell-profile.ps1 in the Scripts subfolder, this will install my-profile.ps1 as your PowerShell profile. It's a nice looking basic profile and can easily be adapted to your needs.
How to add the scripts to the search path?
Want to use the PowerShell scripts everywhere on the command-line? Then you need to add the Scripts/ subfolder to the search path:
- On Linux using Bash: edit .profile in your home directory and add the line: PATH="$PATH:/path/to/PowerShell/scripts (replace '/path/to/)."
- On Windows: open Settings > System > About > Advanced system settings > Environment Variables, edit the user's variable "Path", and add the full path to the Scripts/ directory.
Which editor to use for PowerShell scripts?
- Visual Studio Code - it supports syntax highlighting, on-the-fly problem checking and an integrated PowerShell Console (available for free on Linux, Mac OS and Windows, now recommended by Microsoft).
- PowerShell ISE (Integrated Scripting Environment) - the former official PowerShell development environment included with Microsoft Windows.
- PowerShell Studio - a powerful PowerShell IDE with module, help, and user interface development tools, high DPI support and regular updates.
- PowerShell Plus - an all in one IDE.
- Atom package - an add-on with PowerShell language support for Atom.
- SublimeText package - an add-on with PowerShell language support for Sublime Text.
- or simply your favorite text editor as an alternative.
How to remove the banner message in PowerShell?
- In general: start powershell.exe with option '-nologo'.
- For Windows Terminal: open Settings > Profiles > Windows PowerShell > Command line and add " -nologo".
Where to find even more scripts?
- PowerShellGallery.com - The central repository for sharing and acquiring PowerShell code including PowerShell modules, scripts, and DSC resources.
- ScriptShare.io - ScriptShare is an evergrowing library of scripts and automations.
How to write good PowerShell scripts?
Good scripts are both user-friendly and platform-independent. As a starting point I recommend:
- Use the
<verb>-<noun>.ps1scheme for filenames (e.g. new-symlink.ps1). Official approved verbs can be found here: https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands - Use UTF-8 BOM file encoding to support Unicode characters in your script.
- Add a comment-based help at the beginning with:
.SYNOPSIS,.DESCRIPTION,.PARAMETER,.EXAMPLE,.LINK, and.NOTES. - Add the requirements for your script, e.g.
#Requires -RunAsAdministrator, or#Requires -Version 5 - Check for command-line options, otherwise ask the user for input.
- Recommended is Set-StrictMode -Version Latest to enable additional error checking.
- Use lowerCamelCase to name variables/functions/etc to improve readability.
- Set execute file permissions for Linux: chmod a+rx
- On success exit with error code 0 (exit 0), otherwise print the error with keyword ERROR: (to support log parsers) and exit the error code (mostly 1)
How to contribute or how to report a bug?
If you find something bad (like a bug, error, or any issue), please report it here by opening an Issue.
Or even better: Fork the repository, add or fix the script and submit a pull request, so others can participate too.
How to donate to this project?
Please follow this link: https://www.paypal.com/paypalme/Fleschutz ❤️ Thank you for your help!
What if my question is not answered here?
Please send your question by e-mail to: markus.fleschutz [at] gmail.com