Which PowerShell should you use?
Windows PowerShell 5.1 is the Windows-only edition built on.NET Framework. It receives security updates according to the lifecycle of the Windows release that contains it, but it gets no new features. PowerShell 7 is the actively developed, open-source edition for Windows, macOS, and Linux. Microsoft recommends it for new automation and says it will ship with the next release of Windows. That is a plan for a future release, not a claim that installing November’s Windows updates put PowerShell 7 on every PC.
| Edition | How to start it on Windows | What matters for 2027 |
|---|---|---|
| Windows PowerShell 5.1 | powershell.exe | Keep it for tools that require it; support follows the host Windows version. |
| PowerShell 7.4 LTS or 7.5 | pwsh.exe | Both reached their listed support end dates in November 2026. The executable name alone does not tell you whether you have a supported release. |
| PowerShell 7.6 LTS | pwsh.exe | Released March 18, 2026, built on.NET 10, and supported into November 2028. Keep the 7.6 installation on a current servicing update. |
Microsoft’s US product lifecycle table gives November 15, 2028, as the end date for 7.6; the PowerShell team’s support table gives November 14. For a maintenance calendar, use the earlier date. Neither date is a deadline for Windows PowerShell 5.1. Microsoft intends to remove 5.1 from a future Windows release, with advance notice, but has not set a removal date. Its announced intermediate step is to make 5.1 a Feature on Demand, initially enabled on new installations.
To identify the shell in front of you, enter $PSVersionTable. Read PSEdition and PSVersion together: Desktop with version 5.1 identifies Windows PowerShell; Core with version 7.6.x identifies the current LTS family. This is more reliable than the Start menu label. Microsoft notes in KB5134574 that some existing shortcuts keep their older names even after Windows adds “5.1” to the labels. There is no need to repair a working installation just because a shortcut lacks the number.
The pipeline: work with the data behind the screen
PowerShell is both an interactive shell and a scripting language. You can try a command at the prompt, inspect its result, and put the same command in a .ps1 file when you want to repeat it. Built-in commands, called cmdlets, generally have verb-noun names: Get-Process retrieves running processes; Set-Location changes your working location. Two useful commands to learn early are Get-Command, for discovering what your session can run, and Get-Help, for finding out what a command expects.
The important bit is what travels through the pipe character, |. Between compatible PowerShell commands, it is an object, not merely the text displayed in a terminal. A file object has a name, a full path, a length in bytes, and other properties. That means you can ask for the five largest files in the current folder without parsing a directory listing or moving a single file. In a file-system directory, try:
Get-ChildItem -File |
Sort-Object Length -Descending |
Select-Object -First 5 FullName, Length
Read it from top to bottom: get the files, sort their records by size, then display the full path and byte count for up to five. There is no recursive search here, so the answer concerns this folder, not everything beneath it. To explore what else a file record contains, try Get-ChildItem -File | Get-Member in a folder containing a file. Discovering a property is often easier than guessing what Microsoft called it.
That distinction matters when sharing a report. Use Select-Object to choose the fields, then Export-Csv to write them. Don’t slip Format-Table between the two: formatting is for the reader’s screen, and the exporter will receive formatting instructions rather than the original records. A colleague with a spreadsheet needs the drive name and free-space figure, not directions for drawing a handsome table in your terminal.
Build a weekly Windows disk-space report
TechRepublic uses recurring disk checks to illustrate when automation earns its keep. Here is a local Windows example for either 5.1 or 7.6. It queries fixed logical disks, records their free space, and flags those below an example threshold of 10 GiB. It does not delete files, inspect other PCs, or require a remote session. The Windows-specific part is the Win32_LogicalDisk data source: installing the same shell on a Mac does not give the Mac this Windows class.
1. Prepare a test folder. Choose a local folder where your ordinary account can save files. Save the following as DiskReport.ps1 there. The script puts DiskReport.csv beside itself, rather than relying on whatever working directory a scheduler happens to select. Use a dedicated folder: each successful run is intended to replace the previous snapshot.
$ErrorActionPreference = 'Stop'
$limit = 10GB
$report = Join-Path $PSScriptRoot 'DiskReport.csv'
$disks = @(Get-CimInstance -ClassName Win32_LogicalDisk -Filter 'DriveType = 3')
if ($disks.Count -eq 0) { throw 'No fixed logical disks were returned.' }
$checked = (Get-Date).ToString('s')
$disks | ForEach-Object {
[pscustomobject]@{
Computer = $env:COMPUTERNAME
Checked = $checked
Drive = $_.DeviceID
FreeGiB = [math]::Round($_.FreeSpace / 1GB, 2)
LowSpace = $_.FreeSpace -lt $limit
}
} | Export-Csv -LiteralPath $report -NoTypeInformation
2. Run it once before scheduling it. Open PowerShell in the test folder and run .\DiskReport.ps1. Open the CSV and look for a recent timestamp, the expected computer name, and one row per fixed logical disk returned by Windows. A healthy drive still gets a row, with LowSpace set to False. That is deliberate: an empty list of warnings should not be mistaken for proof that the check actually ran. The comparison uses the original byte count, not the rounded figure shown in the spreadsheet.
3. Schedule the tested script. In Windows Task Scheduler, create a basic task, choose a weekly trigger, and select Start a program. For the program, use the full path to the PowerShell executable you tested. For arguments, use -NoProfile -File "C:\Your Folder\DiskReport.ps1", substituting the real absolute path. Check that the task account can read the script and write to the report folder. A reporting job is not a reason by itself to select the highest privileges.
4. Test the task, not just the script. Run the task manually and check that the timestamp inside the CSV advances. If yesterday’s report is still there, check the task result, executable path, quoted script path, and folder permissions before trusting it. Close the spreadsheet during the test in case it has locked the output file. For a shared report, assign someone to notice a stale timestamp as well as a low-space warning. They are different failures and call for different action.
Move an existing job without breaking it
On a supported Windows client with WinGet available, Microsoft’s installation guide gives winget install --id Microsoft.PowerShell --source winget for the release package. Start pwsh afterward and inspect $PSVersionTable. Installing 7 alongside 5.1 does not redirect a task that explicitly invokes powershell.exe. Windows Terminal can host either shell; the older Windows PowerShell ISE runs 5.1. For editing and debugging PowerShell 7, Microsoft supports Visual Studio Code with the PowerShell extension.
Microsoft’s deprecation advisory recommends looking beyond the scripts folder. Inventory scheduled tasks, installers, management agents, and other tools that start powershell.exe or load Windows PowerShell modules. For each important job, record its executable, account, required modules, and expected result. Choose a read-only job for the first comparison. Run a copy under pwsh.exe with a separate output destination so the trial cannot overwrite the production result.
A successful module import is not a complete compatibility test. On Windows, PowerShell 7 can run certain older modules in a background 5.1 process. Results crossing back into 7 are serialized: you may receive the property values you need for a CSV, but not the live object methods a later line of the script expects. The compatibility feature itself requires local Windows PowerShell 5.1. A script that works through this route has not shed its 5.1 dependency, and it has not become portable to Linux.
Compare the actual fields, errors, and downstream behavior under the account that runs the job. If that comparison passes, switch the task’s executable and inspect its next scheduled result. If it fails on a legacy module, retain the working 5.1 invocation and document precisely which command needs replacing. That gives the next maintainer a smaller, more useful assignment than “rewrite PowerShell.”
Where PowerShell fits—and where it doesn’t
Modules add commands for systems such as Azure, SQL Server, Exchange, and Active Directory. The PowerShell Gallery distributes modules and other resources; PSResourceGet helps find and install them. Installing a module gives your shell a vocabulary, not your account permission to use a service. Likewise, SSH-based PowerShell remoting can support administration across operating systems, but only after the endpoints are configured and the account is authorized. Start with one known target before turning a local report into a fleet inventory.
Not every administrative task calls for a script that performs a sequence of changes. If the requirement is to describe how machines should be configured and check whether they match, Microsoft Desired State Configuration addresses that problem. Microsoft DSC 3.0 is a standalone cross-platform product, not a feature you acquire simply by installing PowerShell 7. It can still use existing PowerShell DSC resources. For a one-off file rename, meanwhile, File Explorer is a perfectly good tool; automation pays off when repetition or consistency matters.
There is no need to abandon a working batch file, Bash workflow, or Python program merely to standardize the prompt. PowerShell’s particular advantage is being able to inspect structured administrative data interactively and then use the same commands in a repeatable job. The shell is free under the MIT license; that license does not pay for cloud resources a script creates or commercial support an organization buys.
Finally, distinguish a preview from a permission check. Where a command implements -WhatIf, use it to inspect intended changes, but don’t assume it simulates an entire unfamiliar script. Windows execution policy helps prevent unintended execution; it is not a security boundary or a verdict that downloaded code is trustworthy. Read the script, use the least privilege the task needs, and verify the result that someone will actually rely on. For the weekly disk check, that result is simple: a current report from the expected PC, produced by the intended shell, with a row for every drive you meant to check.
References
- PowerShell Cheat Sheet 2027: Features, Uses, and Versions - TechRepublic TechRepublic · 2026-11-30T12:59:19+00:00
- Windows PowerShell 5.1 Deprecation | Microsoft Support support.microsoft.com
- Windows PowerShell update message FAQ - PowerShell | Microsoft Learn learn.microsoft.com