How to Check PowerShell Version

Illustration showing how to check PowerShell version: open PowerShell, run Get-Host or $PSVersionTable.PSVersion, or powershell -v, then read Major, Minor and Build numbers. PSCore

How to Check PowerShell Version

Understanding which version of PowerShell you're running isn't just a technical curiosity—it's a fundamental requirement for maintaining secure, efficient, and compatible systems. Whether you're troubleshooting a script that refuses to execute, planning an infrastructure upgrade, or ensuring compliance with organizational security policies, knowing your PowerShell version provides the foundation for informed decision-making. Different versions support different cmdlets, syntaxes, and security features, making version awareness essential for anyone working with Windows automation, system administration, or DevOps workflows.

PowerShell version checking refers to the process of identifying which release of Microsoft's task automation and configuration management framework is currently installed and active on your system. This seemingly simple task encompasses multiple dimensions: the Windows PowerShell legacy versions (1.0 through 5.1) that ship with Windows operating systems, and the cross-platform PowerShell Core (6.x and 7.x) that represents Microsoft's modern, open-source direction. Each version brings distinct capabilities, compatibility considerations, and operational characteristics that directly impact what you can accomplish with your scripts and automation workflows.

This comprehensive guide walks you through multiple methods for checking PowerShell versions across different scenarios and system configurations. You'll discover command-line techniques that work universally, registry-based verification methods for deeper system analysis, graphical approaches for those who prefer visual interfaces, and remote checking capabilities for managing multiple systems. Beyond simple version identification, you'll gain insights into version numbering schemes, compatibility implications, upgrade pathways, and troubleshooting strategies that transform version checking from a basic task into a strategic competency for PowerShell practitioners at any skill level.

Quick Command-Line Methods for Version Detection

The fastest and most universally applicable approach to checking your PowerShell version involves using built-in automatic variables and commands directly within a PowerShell session. These methods work consistently across different Windows versions and PowerShell editions, providing immediate, accurate information without requiring administrative privileges or additional software installations.

Using the $PSVersionTable Automatic Variable

The $PSVersionTable automatic variable represents the most comprehensive single command for version information. This hashtable contains multiple properties that reveal not just the PowerShell version, but also the underlying .NET framework version, the edition (Desktop or Core), and compatibility information. Simply open any PowerShell window and execute this variable to see a complete version profile.

$PSVersionTable

This command returns a structured output displaying several critical properties. The PSVersion property shows the actual PowerShell version number in semantic versioning format (major.minor.patch). The PSEdition property distinguishes between "Desktop" (Windows PowerShell 5.1 and earlier) and "Core" (PowerShell 6.0 and later). The CLRVersion indicates the Common Language Runtime version, while BuildVersion provides detailed build information useful for precise compatibility verification.

"Version checking isn't just about satisfying curiosity—it's about ensuring your scripts will execute as intended and your systems remain secure with current feature sets."

Accessing Specific Version Properties

When you need just the version number without additional metadata, you can directly access specific properties of the $PSVersionTable variable. This approach proves particularly useful in scripts where you need to perform version-based conditional logic or generate reports that include version information as a data point.

$PSVersionTable.PSVersion

This refined command returns only the version number object, which itself contains granular properties like Major, Minor, Build, and Revision. You can further drill down to access individual components:

$PSVersionTable.PSVersion.Major
$PSVersionTable.PSVersion.Minor
$PSVersionTable.PSVersion.Build

These individual property accesses become invaluable when writing compatibility checks in scripts. For example, you might need to verify that a script runs only on PowerShell 5.1 or later, or you might need to implement different code paths depending on whether the user is running PowerShell 7.x versus earlier versions.

Alternative Host Version Command

Another quick method involves querying the host application version using the $Host automatic variable. While this technically reports the host application version rather than the PowerShell engine version, in most scenarios these align closely and provide useful verification information.

$Host.Version

This command specifically reports the version of the host application—whether that's the standard PowerShell console, PowerShell ISE, or another hosting application. In most standard installations, this matches the PowerShell version, but in customized environments or when using PowerShell hosted within other applications, these versions might differ. For comprehensive verification, checking both $PSVersionTable and $Host provides the most complete picture.

Registry-Based Version Verification

For scenarios requiring version checking without launching PowerShell itself, or when you need to verify installed versions programmatically from other tools, the Windows Registry provides alternative verification pathways. PowerShell installation information persists in specific registry locations that can be queried using various methods including other scripting languages, system management tools, or even manual inspection through the Registry Editor.

Locating PowerShell Registry Keys

Windows PowerShell installation information resides in the registry under specific paths that vary slightly depending on the PowerShell version and system architecture. The primary location for PowerShell engine information is:

HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine

Despite the "3" in the path name, this location contains information for PowerShell 3.0 and later versions, including 5.1. The PowerShellVersion value within this key indicates the installed version. You can query this directly from PowerShell using the Get-ItemProperty cmdlet:

Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" -Name PowerShellVersion

This method proves particularly valuable in automation scenarios where you're inventorying multiple systems, creating compliance reports, or verifying installations as part of deployment validation processes. The registry approach works even when PowerShell execution policies might prevent running scripts, providing a reliable fallback verification method.

Checking Installed PowerShell Core Versions

PowerShell Core (versions 6.x and 7.x) uses different installation paths and registry locations compared to Windows PowerShell. These newer versions install side-by-side with Windows PowerShell and maintain separate registry entries, typically under:

HKLM:\SOFTWARE\Microsoft\PowerShellCore

Within this location, you'll find subkeys for each installed version of PowerShell Core, allowing you to identify not just whether PowerShell Core is installed, but specifically which versions are present on the system. This becomes particularly relevant in environments transitioning from Windows PowerShell to PowerShell 7, where multiple versions might coexist during migration periods.

PowerShell Edition Registry Path Version Key Name Typical Location
Windows PowerShell 5.1 HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine PowerShellVersion Built into Windows
PowerShell Core 6.x HKLM:\SOFTWARE\Microsoft\PowerShellCore\6.x Install Separate installation
PowerShell 7.x HKLM:\SOFTWARE\Microsoft\PowerShellCore\7.x Install Separate installation
PowerShell 3.0/4.0 HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine PowerShellVersion Legacy Windows versions

Graphical Interface Version Checking

While command-line methods provide the most efficient and scriptable approaches to version checking, graphical methods offer accessibility for users less comfortable with command-line interfaces and provide visual confirmation that some users find more intuitive. These methods work particularly well for one-time checks or when training users who need to verify their PowerShell version for support purposes.

Using PowerShell ISE About Dialog

The PowerShell Integrated Scripting Environment (ISE) includes a built-in about dialog that displays version information in a user-friendly format. To access this information, launch PowerShell ISE (available in Windows PowerShell 5.1 and earlier), then navigate to the Help menu and select "About Windows PowerShell ISE." The resulting dialog displays the PowerShell version along with copyright information and system details.

This method provides immediate visual confirmation without requiring any command execution or technical knowledge. However, it's important to note that PowerShell ISE is not included with PowerShell Core or PowerShell 7, making this approach specific to Windows PowerShell environments. For newer PowerShell versions, alternative graphical methods or command-line approaches remain necessary.

Windows Settings and Programs Interface

For PowerShell Core and PowerShell 7 installations, the Windows Settings application provides version information through the installed applications list. Navigate to Settings > Apps > Apps & features, then search for "PowerShell" to see installed versions. Each PowerShell Core or PowerShell 7 installation appears as a separate entry with its version number displayed.

This approach helps identify which PowerShell versions are installed as separate applications, but it won't show the built-in Windows PowerShell version since that's considered part of the operating system rather than a separately installed application. For comprehensive version inventorying, combining this graphical method with command-line checks provides the most complete picture of your PowerShell ecosystem.

"Understanding the difference between Windows PowerShell and PowerShell Core isn't just semantic—it fundamentally affects script compatibility, available modules, and long-term supportability."

Remote Version Checking Techniques

System administrators managing multiple computers need efficient methods to check PowerShell versions across their infrastructure without physically accessing each machine. PowerShell's remoting capabilities, combined with various management tools, enable centralized version verification that scales from small workgroups to enterprise environments with thousands of endpoints.

Using PowerShell Remoting

PowerShell remoting leverages the WS-Management protocol to execute commands on remote computers, making version checking straightforward once remoting is properly configured. The Invoke-Command cmdlet allows you to run version-checking commands on one or multiple remote systems simultaneously:

Invoke-Command -ComputerName Server01, Server02 -ScriptBlock { $PSVersionTable.PSVersion }

This command connects to the specified computers and executes the version table query, returning results that include both the version information and the computer name, allowing you to easily identify which systems are running which PowerShell versions. For larger environments, you can read computer names from a text file or query Active Directory to build dynamic computer lists for comprehensive version auditing.

Advanced Remote Querying with CIM

The Common Information Model (CIM) provides another pathway for remote version checking, particularly useful when standard PowerShell remoting isn't available or when you need to query systems using different protocols. While CIM doesn't directly expose PowerShell version information, you can combine CIM queries with registry access to retrieve version data:

$session = New-CimSession -ComputerName Server01
Invoke-Command -Session $session -ScriptBlock { Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" }

This approach creates a CIM session to the remote computer, then uses that session to execute registry queries that reveal PowerShell version information. CIM sessions offer advantages in certain network configurations and can traverse firewalls more easily than traditional PowerShell remoting in some environments.

Building Version Inventory Reports

For ongoing version management, creating automated inventory reports provides valuable documentation and helps identify systems requiring updates. A comprehensive inventory script might query multiple systems, collect version information along with other relevant data like operating system version and last update time, then export results to formats like CSV or HTML for easy review:

$computers = Get-Content "C:\computers.txt"
$results = Invoke-Command -ComputerName $computers -ScriptBlock {
    [PSCustomObject]@{
        ComputerName = $env:COMPUTERNAME
        PSVersion = $PSVersionTable.PSVersion.ToString()
        PSEdition = $PSVersionTable.PSEdition
        OS = (Get-CimInstance Win32_OperatingSystem).Caption
    }
}
$results | Export-Csv "PowerShell_Inventory.csv" -NoTypeInformation

This script pattern demonstrates how version checking integrates into broader system management workflows, transforming a simple version query into actionable infrastructure intelligence that supports planning, compliance, and upgrade decision-making.

Understanding PowerShell Version Numbering

PowerShell version numbers follow semantic versioning principles, but understanding the full context of version evolution, edition differences, and compatibility implications requires deeper knowledge of PowerShell's development history and Microsoft's strategic direction for the platform.

Major Version Milestones

PowerShell's journey from version 1.0 to the current 7.x releases represents significant evolution in capabilities, architecture, and strategic positioning. PowerShell 1.0 launched in 2006 as a Windows-only automation framework. PowerShell 2.0 introduced remoting and background jobs. PowerShell 3.0 brought workflow capabilities and improved performance. PowerShell 4.0 added Desired State Configuration. PowerShell 5.0 and 5.1 introduced classes, package management, and became the final Windows PowerShell versions.

The transition to PowerShell Core 6.0 marked a fundamental shift—Microsoft rebuilt PowerShell on .NET Core, making it cross-platform and open-source. This architectural change brought Linux and macOS support but initially sacrificed some Windows-specific features. PowerShell 7.0 and subsequent releases reconcile these worlds, bringing back Windows compatibility while maintaining cross-platform capabilities, representing Microsoft's current strategic direction for the platform.

"The jump from Windows PowerShell 5.1 to PowerShell 7 isn't just a version increment—it represents a fundamental platform transition that affects everything from module compatibility to deployment strategies."

Edition Differences: Desktop vs. Core

The PSEdition property in $PSVersionTable reveals whether you're running "Desktop" or "Core" edition, a distinction that carries significant implications. Desktop edition refers to Windows PowerShell (versions 1.0 through 5.1) built on the full .NET Framework and available only on Windows systems. Core edition refers to PowerShell Core (6.x) and PowerShell 7+ built on .NET Core/.NET 5+, supporting Windows, Linux, and macOS.

This edition difference affects module compatibility, available cmdlets, and script behavior. Many modules written for Windows PowerShell require the Desktop edition and won't work in Core edition without modification. Conversely, some modern modules target Core edition specifically. Understanding which edition you're running helps predict compatibility issues and informs decisions about which PowerShell version to use for specific tasks.

Version Range Edition Platform Support Key Characteristics
1.0 - 5.1 Desktop Windows only Built on .NET Framework, maximum Windows compatibility
6.0 - 6.2 Core Windows, Linux, macOS Cross-platform, some Windows features missing
7.0+ Core Windows, Linux, macOS Cross-platform with improved Windows compatibility
5.1 (Windows) Desktop Windows only Final Windows PowerShell version, still receives security updates

Version Compatibility Considerations

Knowing your PowerShell version matters most when it affects what you can accomplish with your scripts and automation. Compatibility considerations span multiple dimensions including cmdlet availability, syntax support, module compatibility, and underlying framework capabilities. Understanding these factors helps you write portable scripts, troubleshoot compatibility issues, and make informed decisions about when to upgrade or maintain specific versions.

Cmdlet and Feature Availability

Different PowerShell versions support different cmdlets and language features. PowerShell 5.1 introduced classes, enumerations, and improved debugging capabilities that don't exist in earlier versions. PowerShell 7 adds parallel processing with ForEach-Object -Parallel, ternary operators, and pipeline chain operators that won't work in PowerShell 5.1. When writing scripts intended for broad distribution, you must consider the minimum PowerShell version your target audience runs.

A practical approach involves including version checks at the beginning of scripts that require specific versions. The #Requires statement provides declarative version requirements that PowerShell enforces before executing the script:

#Requires -Version 5.1

This statement prevents script execution on systems running PowerShell versions earlier than 5.1, providing clear error messages rather than cryptic failures when unsupported features are encountered. For more nuanced version checking, you can implement conditional logic that adapts script behavior based on detected versions, providing fallback approaches for older versions while leveraging newer features when available.

Module Compatibility Challenges

PowerShell modules represent one of the most significant compatibility considerations when working across different versions. Many modules written for Windows PowerShell depend on Windows-specific APIs or .NET Framework types that don't exist in PowerShell Core. Conversely, some modern modules leverage .NET Core capabilities unavailable in Windows PowerShell. The module manifest includes compatibility metadata that helps identify these dependencies.

When encountering module compatibility issues, checking the CompatiblePSEditions property in the module manifest reveals whether the module supports Desktop, Core, or both editions. You can query this information programmatically:

Get-Module -Name ModuleName -ListAvailable | Select-Object Name, Version, CompatiblePSEditions

This compatibility awareness helps you choose appropriate modules for your environment and identify potential issues before they affect production systems. Many popular modules now offer separate versions or unified versions that support both Desktop and Core editions, but understanding compatibility remains essential for reliable automation.

"Script portability isn't just about syntax—it's about understanding the ecosystem of cmdlets, modules, and framework capabilities that vary across PowerShell versions and editions."

Upgrading and Managing Multiple Versions

Modern PowerShell environments often involve managing multiple versions simultaneously, particularly during transition periods from Windows PowerShell to PowerShell 7. Understanding how different versions coexist, when to upgrade, and how to manage version-specific configurations ensures smooth operations while maintaining compatibility with existing automation.

Side-by-Side Installation Architecture

PowerShell 7 installs side-by-side with Windows PowerShell 5.1 rather than replacing it, allowing both versions to coexist on the same system. This design acknowledges that organizations need time to migrate scripts and workflows while maintaining backward compatibility with tools and modules that require Windows PowerShell. Each version maintains separate installation directories, module paths, and configuration files.

When both versions are installed, you can explicitly launch either version by using the appropriate executable. Windows PowerShell launches with powershell.exe, while PowerShell 7 uses pwsh.exe. This distinction allows scripts, scheduled tasks, and automation tools to target specific versions explicitly, preventing unexpected behavior when version-specific features are required.

Determining When to Upgrade

Deciding when to upgrade PowerShell versions involves balancing new features, improved performance, and security enhancements against compatibility concerns and testing requirements. PowerShell 7 offers significant advantages including cross-platform support, improved performance, new language features, and ongoing development, while Windows PowerShell 5.1 provides maximum compatibility with existing Windows-focused modules and scripts.

For new projects and scripts, starting with PowerShell 7 makes sense given its active development and long-term strategic positioning. For existing automation, gradual migration allows testing and validation while maintaining production stability. Many organizations adopt a hybrid approach, maintaining Windows PowerShell for legacy automation while developing new scripts in PowerShell 7, gradually migrating tested workflows as resources permit.

Version-Specific Profile Management

PowerShell profiles allow customization of the shell environment, and each PowerShell version maintains separate profile files. Understanding profile locations for different versions helps maintain consistent environments while allowing version-specific customizations. You can identify your current profile path using the $PROFILE automatic variable:

$PROFILE | Select-Object *

This command reveals all profile paths for the current PowerShell version, including CurrentUserCurrentHost, CurrentUserAllHosts, AllUsersCurrentHost, and AllUsersAllHosts profiles. When managing multiple PowerShell versions, you might maintain separate profiles for each version or create shared profile logic that detects the version and adapts accordingly, providing consistent experiences across versions while accommodating version-specific requirements.

"Managing multiple PowerShell versions isn't a temporary transition state—it's a long-term reality for many organizations that need to balance innovation with stability and compatibility."

Version-related problems manifest in various ways, from scripts that fail with syntax errors to modules that won't import to unexpected behavior in familiar commands. Systematic troubleshooting approaches help identify whether version differences cause observed issues and guide resolution strategies that restore functionality while maintaining compatibility.

Identifying Version-Specific Syntax Errors

When scripts fail with syntax errors, version differences often underlie the problem. Features like ternary operators, pipeline chain operators, and null-conditional operators work in PowerShell 7 but cause syntax errors in PowerShell 5.1. Conversely, some Windows PowerShell-specific cmdlets or parameters might not exist in PowerShell Core. Careful examination of error messages often reveals version-related root causes.

A systematic approach involves first confirming the PowerShell version where the error occurs, then researching whether the problematic syntax or cmdlet is supported in that version. Microsoft's documentation includes version compatibility information for cmdlets and language features. When version incompatibility is confirmed, you can either require a specific minimum version using #Requires statements or implement conditional logic that provides version-appropriate alternatives.

Module Import Failures and Version Conflicts

Module import failures frequently stem from edition compatibility issues. When a module designed for Windows PowerShell (Desktop edition) is imported into PowerShell Core, it may fail if it depends on Windows-specific APIs or .NET Framework types. The error messages often reference missing types or assemblies, indicating edition compatibility problems rather than simple bugs.

To diagnose module compatibility issues, check the module's CompatiblePSEditions property and verify it includes the edition you're running. If a required module only supports Desktop edition but you need to use PowerShell Core, investigate whether a Core-compatible version exists or whether Windows PowerShell compatibility mode in PowerShell 7 might provide a workaround. PowerShell 7 includes a compatibility layer that allows some Windows PowerShell modules to function through implicit remoting to a Windows PowerShell session.

Resolving Unexpected Behavior Across Versions

Sometimes scripts execute without errors but produce different results or unexpected behavior across PowerShell versions. These subtle compatibility issues often involve changes in default parameter values, output formatting differences, or behavioral changes in cmdlets between versions. Careful comparison of script behavior across versions helps identify these discrepancies.

When investigating behavioral differences, consult the PowerShell release notes and change logs for the versions in question. Microsoft documents breaking changes and behavioral modifications between versions, providing context for observed differences. In some cases, explicitly specifying parameter values rather than relying on defaults, or using version-specific code paths with conditional logic, resolves these issues while maintaining functionality across versions.

Best Practices for Version Management

Effective PowerShell version management extends beyond simply checking versions to encompass strategic approaches that ensure reliability, maintainability, and compatibility across diverse environments. These practices help organizations balance innovation with stability while minimizing version-related disruptions.

📋 Documenting Version Requirements

Every script and module should clearly document its PowerShell version requirements, both in comments and through #Requires statements. This documentation helps users understand compatibility before attempting to use the script and prevents mysterious failures caused by version mismatches. Include not just minimum version requirements but also notes about tested versions and any known compatibility issues with specific versions.

🧪 Testing Across Target Versions

Scripts intended for broad distribution require testing across all target PowerShell versions and editions. Establish testing environments that include Windows PowerShell 5.1, PowerShell 7, and any other versions your user base might run. Automated testing frameworks like Pester can execute test suites across multiple PowerShell versions, providing confidence that scripts work correctly in all supported environments.

🔄 Implementing Version Detection Logic

For scripts that must work across multiple versions, implement intelligent version detection that adapts behavior based on the detected environment. This approach allows leveraging advanced features in newer versions while providing functional fallbacks for older versions. Use conditional logic based on $PSVersionTable to select appropriate code paths, cmdlets, or parameters for the current version.

📚 Maintaining Version-Aware Documentation

Documentation should clearly indicate which PowerShell versions and editions support each feature, cmdlet, or script. When documenting automation solutions, include version information in requirements sections, installation instructions, and troubleshooting guides. This version awareness helps users understand compatibility considerations before encountering issues and reduces support burden by preventing version-related problems.

🔐 Security Update Awareness

Different PowerShell versions receive different levels of ongoing support and security updates. Windows PowerShell 5.1 continues receiving security updates but no new features, while PowerShell 7 receives both security updates and feature enhancements. Understanding the support lifecycle for each version helps inform upgrade decisions and ensures systems remain secure. Regularly checking for and applying PowerShell updates maintains security posture across your infrastructure.

Advanced Version Analysis Techniques

Beyond basic version checking, advanced techniques provide deeper insights into PowerShell installations, configurations, and capabilities. These methods support specialized scenarios including forensic analysis, detailed compatibility assessment, and comprehensive environment documentation.

Analyzing .NET Framework Dependencies

PowerShell's underlying .NET framework version significantly affects available capabilities and compatibility. Windows PowerShell runs on .NET Framework, while PowerShell Core uses .NET Core/.NET 5+. You can query the specific .NET version using the CLRVersion property in $PSVersionTable or by directly querying .NET runtime information:

[System.Runtime.InteropServices.RuntimeInformation]::FrameworkDescription

This information helps diagnose compatibility issues related to .NET framework dependencies and provides context for understanding why certain modules or scripts behave differently across PowerShell versions. When troubleshooting complex compatibility issues, .NET version information often proves as important as PowerShell version details.

Examining Build and Commit Information

For PowerShell Core and PowerShell 7, the $PSVersionTable includes GitCommitId property that reveals the specific source code commit from which the PowerShell build was created. This granular information helps identify whether you're running a released version, preview version, or custom build, and assists in precisely matching behavior to source code for deep troubleshooting:

$PSVersionTable.GitCommitId

This level of detail becomes particularly valuable when working with preview versions, daily builds, or when reporting issues to the PowerShell development team. The commit ID allows precise identification of the code state, eliminating ambiguity about which specific build exhibits particular behavior or issues.

Creating Comprehensive Environment Reports

For documentation, troubleshooting, or compliance purposes, creating comprehensive environment reports that capture all relevant version information provides valuable reference material. A complete report might include PowerShell version, edition, .NET version, operating system details, installed modules, and execution policy settings:

$report = [PSCustomObject]@{
    PSVersion = $PSVersionTable.PSVersion.ToString()
    PSEdition = $PSVersionTable.PSEdition
    Platform = $PSVersionTable.Platform
    OS = $PSVersionTable.OS
    CLRVersion = $PSVersionTable.CLRVersion.ToString()
    GitCommitId = $PSVersionTable.GitCommitId
    ExecutionPolicy = Get-ExecutionPolicy
    InstalledModules = (Get-InstalledModule).Count
}
$report | Format-List

This reporting approach transforms version checking from a simple query into comprehensive environment documentation that supports troubleshooting, capacity planning, and compliance verification. Such reports provide valuable snapshots of system configurations that can be archived, compared over time, or aggregated across multiple systems for infrastructure analysis.

What's the difference between Windows PowerShell and PowerShell Core?

Windows PowerShell (versions 1.0-5.1) is the original PowerShell built on .NET Framework and available only on Windows systems. PowerShell Core (6.x and later, now called PowerShell 7+) is rebuilt on .NET Core, making it cross-platform and supporting Windows, Linux, and macOS. PowerShell 7 represents the current strategic direction with ongoing development, while Windows PowerShell 5.1 receives only security updates.

Can I run both Windows PowerShell and PowerShell 7 on the same computer?

Yes, PowerShell 7 installs side-by-side with Windows PowerShell 5.1 without replacing it. Both versions can coexist and run simultaneously on the same system. Windows PowerShell uses powershell.exe while PowerShell 7 uses pwsh.exe, allowing you to explicitly launch either version as needed.

How do I check PowerShell version on a remote computer?

Use the Invoke-Command cmdlet with PowerShell remoting to check versions on remote computers: Invoke-Command -ComputerName RemotePC -ScriptBlock { $PSVersionTable.PSVersion }. This executes the version check on the remote system and returns the results to your local session.

Why does my script work in PowerShell 7 but not PowerShell 5.1?

PowerShell 7 includes new language features and cmdlets not available in PowerShell 5.1, such as ternary operators, pipeline chain operators, and ForEach-Object -Parallel. If your script uses these features, it will fail in older versions. Check your script for version-specific syntax and either add version requirements or implement conditional logic for compatibility.

Should I upgrade from Windows PowerShell 5.1 to PowerShell 7?

For new projects, PowerShell 7 is recommended as it receives ongoing development and new features. For existing automation, evaluate whether your scripts and modules are compatible with PowerShell 7, as some Windows-specific modules may require Windows PowerShell. Many organizations maintain both versions during a gradual migration period.

What does the PSEdition property tell me?

The PSEdition property in $PSVersionTable indicates whether you're running "Desktop" edition (Windows PowerShell 5.1 and earlier, built on .NET Framework) or "Core" edition (PowerShell 6+ built on .NET Core). This distinction affects module compatibility and available features, making it important for troubleshooting compatibility issues.

How can I make my scripts compatible with multiple PowerShell versions?

Implement version detection logic using $PSVersionTable.PSVersion at the start of your scripts, then use conditional statements to execute different code paths based on the detected version. Avoid version-specific syntax when possible, or provide fallback approaches for older versions. Test scripts across all target versions before deployment.

Where can I find PowerShell version information without running PowerShell?

Check the Windows Registry at HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine for Windows PowerShell versions, or HKLM:\SOFTWARE\Microsoft\PowerShellCore for PowerShell Core/7 installations. You can query these registry keys using other tools like cmd.exe with reg query commands or programmatically from other scripting languages.

SPONSORED

Sponsor message — This article is made possible by Dargslan.com, a publisher of practical, no-fluff IT & developer workbooks.

Why Dargslan.com?

If you prefer doing over endless theory, Dargslan’s titles are built for you. Every workbook focuses on skills you can apply the same day—server hardening, Linux one-liners, PowerShell for admins, Python automation, cloud basics, and more.