Setting up a proper PowerShell environment involves choosing the right version to install, picking an editor, and understanding how startup customization works through profile files.
Installing PowerShell
PowerShell comes in two distinct editions: the legacy built-in Windows PowerShell and modern, cross-platform PowerShell 7+.
Windows PowerShell (Built-in)
Every modern version of Windows ships with Windows PowerShell pre-installed. You can launch it in several ways:
- Type
powershellinto the Start menu search bar (easiest way). - Run
powershell.exedirectly fromC:\Windows\System32\WindowsPowerShell\v1.0\. - Open it from Windows Terminal via the dropdown menu.
This built-in version is Windows PowerShell 5.1: it's stable but no longer receives new features.
PowerShell 7 (Recommended)
For active development and cross-platform support, install PowerShell 7, distributed separately from Windows.
winget install --id Microsoft.PowerShell --source wingetwhere:
wingetis the Windows Package Manager, pre-installed on modern Windows 10/11.--id Microsoft.PowerShellspecifies the exact package to install.
Alternatively, download the installer .msi package directly from the official PowerShell GitHub releases page.
Once installed, PowerShell 7 runs via the pwsh executable, separate from the legacy powershell.exe.
Installing on Linux and macOS
PowerShell 7 is fully supported on Linux and macOS since it's built on the cross-platform .NET runtime.
macOS
brew install --cask powershellLinux (Ubuntu/Debian example)
sudo apt update
sudo apt install -y powershellwhere:
aptis the Debian/Ubuntu package manager.- Package names and installation steps vary slightly by distribution, so refer to the official Microsoft docs for your specific distro.
Once installed, launch PowerShell on any platform with:
pwshChoosing an Editor
Several tools can be used to write and run PowerShell scripts, ranging from basic to fully featured.
| Tool | Description | Best For |
|---|---|---|
| PowerShell ISE | Windows-only, built-in graphical editor bundled with Windows PowerShell 5.1 | Legacy scripting, simple edits (no longer actively developed) |
| Windows Terminal | Modern, tabbed terminal application supporting pwsh, cmd, and WSL |
Running scripts, interactive sessions |
| Visual Studio Code | Free, cross-platform code editor with the official PowerShell extension | Writing, debugging, and maintaining scripts (recommended) |
Checking Your Version
Once PowerShell is installed, verify the version and environment details using the $PSVersionTable automatic variable.
$PSVersionTableName Value
---- -----
PSVersion 7.6.6
PSEdition Core
GitCommitId 7.6.6
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0where:
PSVersionshows the installed PowerShell version.PSEditionindicates whether it's Core (PowerShell 6+) or Desktop (Windows PowerShell 5.1 and earlier).OSandPlatformdisplay the underlying operating system details.
Profile Files ($PROFILE)
A profile is a script that runs automatically every time a PowerShell session starts, similar in purpose to .bashrc in Bash. It's used to customize your environment: defining aliases, functions, variables, or setting preferences.
The path to the current user's profile is stored in the $PROFILE automatic variable.
$PROFILEC:\Users\Tom\Documents\PowerShell\Microsoft.PowerShell_profile.ps1If the file doesn't exist yet, create it:
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}where:
Test-Pathchecks whether the profile file already exists.New-Item -ItemType Filecreates the file (and any missing parent folders, due to-Force) if it doesn't.
Open the profile in your editor and add customizations, such as a custom alias or a startup message:
Set-Alias ll Get-ChildItem
Write-Host "Welcome back, Tom! Today is $(Get-Date -Format 'dddd, MMMM dd')."Next time you open PowerShell, your customizations load automatically:
Welcome back, Tom! Today is Sunday, September 27.Next Steps
Continue to PowerShell Frequently Used Cmdlets to learn the most essential cmdlets every PowerShell user should know, including Get-Help, Get-Command, and Get-Member.