Fact-checked by Grok 2 weeks ago

PowerShell

PowerShell is a cross-platform task and solution developed by , consisting of a command-line , a built on the .NET Common Language Runtime, and a framework that includes Desired State Configuration (DSC) for managing system configurations. Initially released on November 14, 2006, as Windows PowerShell 1.0, it was designed to enable IT professionals and developers to automate administrative tasks on Windows systems through object-oriented pipelines that pass .NET objects rather than text. The accepts and returns .NET objects, allowing for more structured data handling compared to traditional text-based shells like Command Prompt or Unix shells. PowerShell evolved from an internal Microsoft project called , conceptualized in a 2002 manifesto by architect , which envisioned a more powerful scripting environment for Windows administration. Over the years, Windows PowerShell versions were bundled with Windows Management Framework updates, with major releases including in 2009 (introducing remote management and modules), 3.0 in 2012 (adding support), 4.0 in 2013 (enhancing ), and 5.1 in 2016 (improving and logging). In 2016, open-sourced PowerShell under the . PowerShell Core 6.0 was released in 2018, extending support to and macOS while building on .NET Core for cross-platform compatibility. Key features of PowerShell include its extensibility through modules from the PowerShell Gallery, which hosts thousands of community and official packages for tasks like management, automation, and pipelines; support for both imperative scripting and declarative configuration; and integration with tools like for enhanced editing and debugging. It supports push and pull deployment models for , enabling consistent environment setups across hybrid cloud and on-premises infrastructures, and provides cmdlets—specialized .NET classes—for over 1,000 built-in commands covering file management, process control, and network operations. As of 2025, the latest stable version is PowerShell 7.5 (with 7.4 as the current LTS release), built on .NET 9, offering improved performance, security enhancements like enhanced execution policy controls, and broader adoption in continuous integration/continuous deployment () workflows.

History

Early Concepts and Project Monad

The early concepts for what would become PowerShell originated in 2002, when , a architect focused on management technologies, began developing a prototype for an advanced administrative to improve Windows system automation. This effort addressed the inefficiencies of existing tools like and batch scripting, which were limited by their text-stream model that required manual parsing and was prone to errors in handling structured data for complex administrative tasks. Snover's vision emphasized leveraging the .NET Framework to enable object-oriented command processing, allowing administrators to work with rich data types directly rather than strings. Central to these concepts was the "," a foundational document authored by Snover on August 8, 2002, which articulated the project's principles, problems it aimed to solve, and proposed solutions. The manifesto described Project as a next-generation comprising a task-based , scripting language, and automation model built on .NET objects, designed to bridge the gap between graphical user interfaces and low-level programming for non-developer administrators. It highlighted motivations such as reducing administrative costs through consistent, composable commands and enabling scalable automation across distributed systems, contrasting sharply with the ad-hoc nature of batch files and command-line parsing in . Project Monad was publicly announced and demonstrated by Snover at Microsoft's Professional Developers Conference (PDC) in October 2003, introducing the prototype—codenamed Monad—to developers and showcasing its object-based pipeline for administrative tasks. This event marked the shift from internal ideation to broader awareness, building on the early prototype's demonstrations of benefits like unified access to filesystems and registries via simple, verb-noun commands. Following the announcement, internal development proceeded under Snover's leadership with a core team of Microsoft engineers, focusing on refining the shell's architecture, security features, and integration with .NET until the project's evolution into Windows PowerShell 1.0 in 2006. This phase involved iterative prototyping and testing to ensure robustness for enterprise administration, culminating in a stable release that realized the manifesto's object-centric vision.

Development of Windows PowerShell

Windows PowerShell 1.0 was released on November 14, 2006, as an optional download for Service Pack 2, Service Pack 1, and subsequent versions, marking the initial public availability of the shell for advanced Windows administration and . The version evolved through several updates delivered via Windows Management Framework (WMF) packages. Windows PowerShell 2.0, released in July 2009 and included natively in and , introduced modules for organizing cmdlets and scripts, as well as remoting capabilities for executing commands across networked Windows machines. Windows PowerShell 3.0, available in October 2012 as part of WMF 3.0 and integrated into and , added workflow support for long-running, resumable processes that could span multiple machines and introduced just-in-time (JIT) compilation for performance optimization, along with initial CIM cmdlets. Building on this, Windows PowerShell 4.0, released in October 2013 via WMF 4.0 and bundled with and , enhanced support for through improved CIM cmdlets for querying and managing system data remotely. Windows PowerShell 5.0 and 5.1, released in February 2016 as WMF 5.0/5.1 and included in and , introduced class-based scripting for defining object-oriented structures directly in scripts. These versions emphasized deep integration with core Windows components, providing dedicated modules and cmdlets for managing features such as Task Scheduler via the ScheduledTasks module, Event Viewer through Get-WinEvent and related cmdlets, and using the ActiveDirectory module for user, group, and domain operations. Initial adoption faced challenges, including a steep for administrators familiar with command-line tools like CMD and the need for training in object-oriented scripting, but PowerShell experienced substantial growth in enterprise Windows environments as a preferred tool for automating routine administrative tasks and ensuring consistent system management across large-scale deployments. Its limitations in non-Windows ecosystems eventually prompted the open-sourcing effort in 2016.

Open-Sourcing and Cross-Platform Evolution

In 2016, announced the open-sourcing of PowerShell under the , marking a significant shift from its proprietary Windows-only roots to a collaborative, community-driven project. This decision was publicly revealed on August 18, 2016, enabling developers worldwide to contribute to its development and extending its reach beyond the Windows ecosystem. The move aligned with 's broader embrace of open-source practices, building on the foundation of .NET Core to facilitate cross-platform compatibility. Following the announcement, the official PowerShell repository was established in late 2016, serving as the central hub for , issue tracking, and contributions. By 2017, the repository had gained momentum, with initial ports to and macOS alphas released to test cross-platform functionality. This open-source pivot culminated in the launch of PowerShell Core 6.0 on January 10, 2018, the first stable, generally available version supporting Windows, (including , , and ), and macOS, powered by .NET Core 2.0. PowerShell Core introduced a unified that addressed platform-specific limitations of the prior Windows PowerShell 5.1, enabling seamless scripting and automation in heterogeneous environments. The evolution continued with the rebranding from "PowerShell Core" to simply "PowerShell" starting with version 7.0, released on March 4, 2020, to reflect its maturation as the primary, cross-platform iteration aligned with the .NET ecosystem. This unified branding emphasized its role as the go-to shell for modern development, while maintaining with Windows PowerShell. The GitHub repository has since fostered extensive community involvement, with over 40,000 stars and thousands of forks, driving enhancements like improved cross-platform testing frameworks and integrations. Notable contributions include community-developed modules for resource management, such as extensions to the Az PowerShell module, which leverage the open-source core for cloud automation tasks. These efforts have solidified PowerShell's position as a versatile tool for and infrastructure management across operating systems.

Recent Milestones and Community Contributions

PowerShell 7.0, released on March 4, 2020, marked a significant unification of the PowerShell Core and Windows PowerShell branches, enabling side-by-side installation with the legacy Windows PowerShell 5.1 while providing cross-platform capabilities across Windows, macOS, and . From 2021 onward, the project emphasized (LTS) releases to ensure stability for environments. PowerShell 7.2, designated as an LTS version and released on November 8, 2021, introduced enhancements in SSH remoting and parallel execution, with support extending until its end-of-support date of November 8, 2024. This was followed by PowerShell 7.4, another LTS release on November 16, 2023, built on .NET 8 and supported until November 10, 2026, which added features like improved error handling and compatibility with modern .NET workloads. As of November 2025, 7.5 serves as the current stable release (latest patch 7.5.4 released October 16, 2025), launched on January 23, 2025, and built on , offering standard-term support until May 12, 2026. This version includes performance optimizations, such as faster array handling and leveraging 's runtime improvements for better execution speed, alongside advancements in package management through the module for streamlined module installation and updates. In August 2025, Microsoft began removing PowerShell 2.0 from Windows 11 version 24H2 and Windows Server 2025, encouraging migration to PowerShell 7.x for continued support and security. The ecosystem has seen substantial growth in DevOps integrations, with PowerShell scripts commonly embedded in GitHub Actions workflows for automating builds, tests, and deployments, supported by official actions like Azure PowerShell for seamless Azure resource management. Similarly, tools like PSDevOps enable direct automation of Azure DevOps pipelines, fostering hybrid cloud automation practices. Community involvement remains vibrant through events such as the annual PowerShell + DevOps Global Summit, held in Bellevue, Washington, which in 2025 (April 7–10) gathered professionals for sessions on automation, security, and cross-platform scripting, promoting knowledge sharing and collaboration. An early community-driven milestone was the project, an open-source reimplementation of PowerShell using .NET and Mono for systems, initiated in 2008 and active through the 2010s, though it is now deprecated in favor of the official cross-platform PowerShell.

Design

Core Philosophy

PowerShell's core philosophy centers on transforming system administration and task by addressing longstanding limitations in traditional command-line interfaces, as articulated in the original Monad Manifesto by its architect in 2002. This vision emphasizes creating a robust, extensible framework that enables IT professionals to manage complex environments efficiently, reducing the cognitive burden of routine operations and allowing focus on higher-level problem-solving. Drawing from principles of clarity and customer value, PowerShell was designed to bridge the gap between administrative needs and programming capabilities, promoting a where is intuitive and scalable rather than ad hoc. A foundational principle is the use of structured data through .NET objects rather than unstructured text streams, which minimizes parsing errors common in text-based shells and enhances reliability in administrative workflows. In traditional shells, output is treated as , often requiring fragile string manipulation to extract information; PowerShell's object-oriented passes fully formed .NET objects directly between commands, preserving and enabling seamless manipulation of properties and methods without reformatting. This approach significantly reduces errors in tasks like log analysis or , where misparsed text can lead to operational failures. Discoverability is another key tenet, achieved through a consistent verb-noun for cmdlets and integrated help systems that allow users to explore functionality intuitively. Commands follow a standardized format, such as "Get-Process," where the verb describes the action and the noun identifies the resource, facilitating natural language-like queries via cmdlets like Get-Command. Built-in help, accessible through Get-Help, provides detailed syntax, examples, and information, empowering administrators to learn and compose solutions on the fly without external documentation. This design fosters self-sufficiency, particularly for IT professionals transitioning from graphical tools. Deep integration with the .NET Framework (and later .NET Core) underpins PowerShell's extensibility, allowing it to leverage a vast ecosystem of libraries for advanced operations while maintaining a simple interface. All cmdlets and scripts operate on .NET types, enabling direct access to classes, assemblies, and runtime features for tasks ranging from file I/O to web interactions, without needing separate language switches. This unification eliminates silos between shell scripting and full programming, making PowerShell a versatile tool for both quick tasks and complex applications. The philosophy also promotes a shift from purely procedural scripting to declarative , particularly through features like Desired State Configuration (DSC), which allows IT pros to define desired system states rather than step-by-step instructions. This idempotent approach ensures configurations are consistently applied and maintained, reducing drift in environments and simplifying compliance. By automating the "what" over the "how," PowerShell aligns with broader principles that free administrators to innovate rather than micromanage routines.

Cmdlets and Command Model

Cmdlets form the foundational building blocks of PowerShell commands, designed as lightweight, focused units that perform specific operations on objects within the shell environment. A cmdlet is typically implemented as a compiled .NET class deriving from the System.Management.Automation.Cmdlet base class, enabling efficient execution and integration with the .NET framework. They adhere to a strict verb-noun naming convention, where the verb indicates the action (e.g., Get, Set, New) and the noun specifies the target resource (e.g., Process, Service), such as Get-Process for retrieving running processes. This convention ensures discoverability and consistency, with approved verbs maintained in a standard list to promote uniformity across commands. Cmdlet design emphasizes parameters for flexibility, allowing users to customize behavior without altering the core command. Parameters are defined as public properties in the .NET class, supporting types like strings, integers, or complex objects, and can include validation attributes to enforce constraints (e.g., mandatory, range-limited). Switches, as boolean parameters, enable or disable features toggled by presence (e.g., -Force to override prompts), streamlining command invocation. Pipeline input binding is a key aspect, where parameters are attributed with ValueFromPipeline or ValueFromPipelineByPropertyName to accept objects streamed from preceding commands, facilitating object-oriented data flow without explicit variable assignment. For instance, in Get-Process, the Name parameter can bind pipeline input by property name, allowing commands like Get-Service | Get-Process to process service-related objects seamlessly. Beyond binary cmdlets, PowerShell supports advanced functions and scripts that emulate cmdlet behavior, enabling script-based development without requiring .NET compilation. These are PowerShell functions decorated with the CmdletBinding() attribute, which activates cmdlet-like features such as automatic parameter parsing, common parameters (e.g., -Verbose, -ErrorAction), and support for binding. Developers use approved verbs in function names (e.g., Get-UserInfo) and define parameters similarly to cmdlets, often with help comments for Get-Help integration. This approach allows scripts to mimic native cmdlets, promoting while leveraging PowerShell's scripting capabilities for . Cmdlets and their script equivalents play a crucial role in modularization, encapsulating administrative tasks into reusable components that can be packaged into for distribution and reuse. group related cmdlets, functions, and resources into self-contained units, exportable via Export-ModuleMember to make them available on demand, reducing pollution and enhancing maintainability in environments. This supports reusability in tasks like system management or workflows, where individual cmdlets can be composed without redundancy.

Pipeline and Object Flow

PowerShell's pipeline represents a fundamental departure from traditional text-based pipelines in shells, where output is passed as unstructured s that often require parsing to extract meaningful . In contrast, PowerShell pipelines stream fully structured .NET objects between commands, preserving their original types, properties, and methods throughout the flow. This object-oriented approach allows downstream commands to directly access and manipulate rich without string manipulation or reformatting, enabling more powerful and efficient automation tasks. The pipeline employs streaming semantics, processing objects one at a time in a lazy evaluation manner to efficiently handle large datasets without loading everything into memory upfront. When multiple objects are piped to a command, PowerShell delivers them sequentially to the receiving cmdlet, which processes each immediately upon receipt rather than buffering the entire collection. This design supports scalability for operations on voluminous data sources, such as file systems or remote queries, by minimizing resource consumption and enabling real-time processing. For example, the command Get-ChildItem | Where-Object { $_.Length -gt 1MB } streams directory entries lazily, filtering large files as they are enumerated without storing the full list. To display pipeline output in a human-readable format, PowerShell automatically invokes formatters like Out-Default at the end of interactive , converting objects to textual representations via the formatting system. Out-Default routes objects to appropriate format cmdlets—such as Format-Table for tabular views or Format-List for detailed listings—based on the object's type and pipeline context, ensuring consistent rendering without altering the underlying . This separation allows to remain object-centric until the final output stage, where conversion occurs only as needed for console display or redirection. Error handling in pipelines leverages PowerShell's stream model, distinguishing success output from errors akin to stdout and stderr in other shells, with non-terminating errors collected in the automatic $Error variable for later inspection. When an error occurs during pipeline execution, it is directed to the error stream and appended to $Error, an array that maintains the most recent errors (up to a configurable depth), allowing scripts to continue processing subsequent objects while capturing failures for analysis. Cmdlets can be configured with parameters like -ErrorAction to control behavior, such as stopping the pipeline on errors or silencing them, ensuring robust data flows in automated scenarios.

Scripting Language Features

PowerShell scripts are stored in plain text files with the .ps1 extension, allowing users to save sequences of commands for reuse and automation. These files can be executed directly in a PowerShell session or invoked via cmdlets like Invoke-Expression, provided the system's execution policy permits it. Execution policies, configurable via the Set-ExecutionPolicy cmdlet, define security levels such as Restricted (no scripts allowed), AllSigned (only signed scripts), RemoteSigned (local scripts unrestricted but remote ones signed), and Unrestricted (all scripts allowed with warnings for remote files). These policies help prevent unauthorized or malicious script execution by controlling configuration file loading and script running. Profile scripts, also .ps1 files, enable customization of the PowerShell environment by running automatically at session startup, such as setting aliases, variables, or loading modules. Common profiles include the AllUsersAllHosts profile for system-wide settings and the CurrentUserCurrentHost for user-specific configurations in the console host. Like other scripts, profiles are subject to execution policies, which may block their loading if set to Restricted. For modular extensions, PowerShell uses .psm1 files as script modules, which contain functions, variables, and aliases that can be imported into sessions. PowerShell provides robust control structures for scripting logic, including conditionals and loops that operate on .NET objects rather than strings. The if statement evaluates conditions to execute statement blocks, supporting comparisons with operators like -eq, -ne, -gt, and logical operators such as -and and -or. For error handling, the try-catch-finally construct captures terminating errors in catch blocks, allowing specific responses, while the finally block ensures cleanup regardless of success or failure; non-terminating errors can be converted to terminating ones using ErrorActionPreference. Loops include [foreach](/page/Foreach) for iterating over collections using syntax like `foreach (item in $collection) { ... }`, which accesses each object directly; while and do-while for condition-based repetition, where do-while evaluates the condition after the first iteration; and for loops for counter-based iteration with initialization, condition, and increment steps. The extends conditional logic by matching input against multiple patterns or conditions, uniquely supporting direct object evaluation without conversion—using the automatic _ to reference the current object in script block conditions. For example, `switch (date) { {$_.Year -eq 2021} { "Old year" } default { "New year" } }` processes DateTime objects by their properties. Break and continue statements control loop and switch flow, with break exiting the structure and continue skipping to the next iteration. Introduced in PowerShell 2.0, the module system facilitates packaging and distribution of reusable code through cmdlets like Import-Module and Export-ModuleMember. Script modules (.psm1) export functions, aliases, and variables, while binary modules (.dll) provide compiled cmdlets; manifests (.psd1) describe module metadata, dependencies, and exported members for structured packaging. Modules can include Desired State Configuration (DSC) resources for declarative management, imported via the same mechanisms. The PowerShell Gallery serves as a repository for community modules, installable with Install-Module. PowerShell remoting leverages the WS-Management (WSMan) protocol for secure, distributed script execution across machines, enabled by the Enable-PSRemoting cmdlet which configures WinRM listeners and firewall rules. Commands like Invoke-Command and New-PSSession allow running scripts on remote computers, supporting one-to-one or one-to-many scenarios with authentication via Kerberos or certificates. WSMan, Microsoft's implementation of the SOAP-based WS-Management standard, ensures firewall-friendly communication over HTTP/HTTPS ports 5985/5986. This enables scripts to manage remote systems without direct access, integrating with local scripting constructs for hybrid workflows.

Extended Type System

The Extended Type System (ETS) in PowerShell builds upon the .NET Framework's type system by enabling developers and administrators to extend and customize the behavior of objects at runtime, allowing for richer interactions without modifying underlying .NET code. At its core, ETS leverages the PSObject class, which wraps any .NET object to add layers of , properties, methods, and display configurations, facilitating seamless integration of structured data in scripts and pipelines. This system ensures that PowerShell maintains compatibility with scalar types like strings and integers from .NET while empowering users to treat complex objects—such as those from WMI or —as first-class citizens with enhanced discoverability and manipulability. A key component of ETS is the use of Types.ps1xml files, which define XML-based configurations for type extensions and formatting. These files, typically located in the PowerShell installation directory (e.g., Types.ps1xml for core types), specify how objects of particular .NET types should be displayed in the console, including custom views, property aliases, and script blocks for computed properties. For instance, administrators can create or modify these files to add a "DisplayName" alias for objects, altering output without changing the object's intrinsic structure, which promotes consistent and user-friendly rendering across sessions. PowerShell loads these files automatically on startup, allowing global customizations that apply to all instances unless overridden. ETS further supports dynamic extension of existing .NET types through cmdlets like Add-Member, which enables the addition of note properties, aliases, script methods, or even entire type data at . This dynamism is particularly useful for scripting scenarios where objects need ad-hoc enhancements; for example, one can append a calculated "FileSizeMB" property to a FileInfo object using Add-Member -MemberType NoteProperty -Name FileSizeMB -Value ($_.Length / 1MB). Such extensions are non-destructive and scoped to the object or session, preserving the original .NET type while layering PowerShell-specific behaviors. This capability underscores ETS's role in fostering extensible, object-oriented scripting without requiring recompilation of .NET assemblies. Introspection and discoverability are central to ETS, primarily through the Get-Member cmdlet, which reveals an object's members—including inherited .NET properties, ETS-added elements, and type-specific configurations. By piping an object to Get-Member, users can inspect types, methods, and properties (e.g., Get-Process | Get-Member -MemberType Property), aiding in and learning object models interactively. This reflective mechanism integrates with ETS to expose extended members transparently, ensuring that customizations from Types.ps1xml or Add-Member appear alongside native ones, thus enhancing the shell's usability for complex object manipulation. Overall, balances innovation with backward compatibility by treating all values as PSObjects under the hood, allowing scalar .NET types to flow unchanged in pipelines while complex objects gain extensible features. This design prevents disruptions to traditional or batch scripting patterns when migrating to PowerShell, as basic types like integers retain their scalar behavior despite the underlying PSObject wrapper.

Hosting and Extensibility

PowerShell supports embedding its runtime engine into custom applications through the System.Management.Automation namespace, enabling developers to execute scripts and commands within non-shell environments. Central to this is the runspace, which represents the execution context for PowerShell code, including session state, commands, and variables. To host a runspace, applications create an InitialSessionState object to define the environment—such as importing specific modules or restricting commands—and then instantiate a Runspace object using this state. Once created, pipelines can be built and invoked against the runspace to process objects programmatically, allowing seamless integration of PowerShell's object-oriented pipeline into .NET applications. Extensibility in PowerShell is achieved primarily through modules and, to a lesser extent, legacy snap-ins, which allow adding custom cmdlets, providers, and types to the environment. Snap-ins, introduced in Windows PowerShell 1.0, are .NET assemblies that extend the by registering cmdlets and providers, loaded via the Add-PSSnapin cmdlet for session-specific use or persisted in profiles. However, starting with PowerShell 3.0, snap-ins have been deprecated in favor of , which offer greater flexibility, automatic loading on demand, and better cross-platform support; only the core Microsoft.PowerShell.Core snap-in remains active by default. can be authored to include cmdlets that interact with the , supporting input binding for object flow and output formatting. The pipeline itself can be customized by developers creating cmdlets or advanced functions that participate in object streaming, using attributes like [CmdletBinding()] and [Parameter(ValueFromPipeline=$true)] to enable binding from prior command outputs. In hosted scenarios, applications can further tailor pipelines by configuring proxy commands or overriding default behaviors during runspace creation. Additionally, the eventing subsystem provides asynchronous extensibility via the PSEventManager class, which manages event subscriptions, forwarding, and job-like handling of .NET events raised during execution, such as file system changes or timer expirations. This allows scripts to respond reactively without blocking the main pipeline. Practical examples of hosting include integration in development tools. In , the Package Manager Console embeds a PowerShell host to execute cmdlets like Install-Package, providing context-aware scripting for package management within the IDE. Similarly, (SSMS) allows starting a PowerShell session directly from Object Explorer by right-clicking an object, which presets the current location to that object and loads SQL Server-specific modules for database administration tasks. These integrations leverage runspaces to combine PowerShell's automation capabilities with application-specific contexts.

Desired State Configuration

Desired State Configuration (DSC) is a management platform within PowerShell that enables declarative of and applications, treating configuration as to ensure idempotent deployments. Introduced with Windows Management Framework 3.0 in December 2012 alongside PowerShell 3.0, DSC allows administrators to define the desired state of systems—such as installed software, registry settings, or file structures—without specifying procedural steps, promoting consistency across environments. This approach supports principles by enabling configurations to be version-controlled, tested, and repeatedly applied to achieve the same outcome regardless of the initial system state. At its core, DSC uses configuration documents written in PowerShell syntax that compile into Managed Object Format (MOF) files, which describe the target state in a standardized, machine-readable format based on the (DMTF) standards. These configurations are built from DSC resources—modular units like xFile for managing files or xService for services—that encapsulate the logic to enforce specific settings, with over 100 and official resources available for common tasks such as package installation or user management. Configurations can be applied in push mode, where the authoring machine directly applies the MOF to target nodes, or pull mode, where nodes retrieve configurations from a central pull for autonomous enforcement, reducing administrative overhead in large-scale deployments. The Local Configuration Manager (LCM), an embedded component on each target node, orchestrates the application of configurations by monitoring compliance, handling reboots if needed, and reporting status, ensuring the system remains in the desired state over time. DSC integrates seamlessly with Automation State Configuration, allowing cloud-based management of hybrid environments where configurations are stored, compiled, and pulled from Azure, similar to declarative tools like but optimized for Windows ecosystems. In early 2025 (general availability March 2025), Microsoft released Desired State Configuration (DSC) 3.0, a cross-platform, standalone configuration management tool independent of PowerShell, supporting Windows, Linux, and macOS. It uses JSON or YAML for configuration documents and enables resources in any language (e.g., Bash, Python, C#), while providing compatibility with existing PowerShell DSC resources through adapters like Microsoft.DSC/PowerShell. This update decouples DSC from PowerShell and Windows-specific dependencies, allowing declarative management across diverse operating systems as a command-line tool without a Local Configuration Manager; configurations are invoked directly rather than as a service.

Versions

Windows PowerShell (1.0–5.1)

Windows PowerShell 1.0 provided a foundational set of over 130 cmdlets designed for system administration tasks, including managing services, processes, event logs, and the registry, all built on the .NET Framework to enable object-oriented scripting and automation in Windows environments. This version emphasized pipeline processing of .NET objects rather than text streams, allowing direct manipulation of data without parsing, but it did not include module support for packaging cmdlets or remoting capabilities for remote execution. Windows PowerShell 2.0 expanded extensibility with the introduction of modules, enabling developers to package and distribute reusable units of cmdlets, functions, and scripts as self-contained components that could be imported into sessions. It added eventing support through the PSEvent class, allowing cmdlets to subscribe to and raise events for asynchronous notifications, and background jobs via cmdlets like Start-Job, which permitted long-running tasks to execute independently without blocking the primary session. These features facilitated more robust automation in environments, including remote runspaces for executing commands on distant machines. Windows PowerShell 3.0, delivered via Windows Management Framework 3.0, introduced Windows PowerShell , a feature for defining long-running, resumable sequences of activities using XAML-based activities that supported parallelism, checkpoints for , and execution across multiple devices. auto-loading was added, automatically importing installed modules from standard paths like PSModulePath upon first use of a command, reducing manual Import-Module calls and improving discoverability in and Server 2012. Building on version 3.0, Windows PowerShell 4.0 in Windows Management Framework 4.0 refined capabilities with better integration for multi-machine orchestration and error handling, while enhancing module auto-loading for faster session startup and support for dynamic module discovery. It included optimizations for the Operational Records (OR) provider, enabling streamlined access to event logs and performance counters in through provider-specific cmdlets. Windows PowerShell 5.1, part of Windows Management Framework 5.1, introduced compatibility with , allowing direct local execution of PowerShell scripts and cmdlets on this minimal, headless installation without requiring full remoting setup. It implemented just-in-time formatting for output views, deferring format customization until display to optimize performance and reduce memory usage in large-scale data processing on and Server 2016. Additionally, persistent classes were added, enabling the definition of custom object-oriented classes within scripts that maintain state and structure across module imports and sessions for more reliable Windows automation.

PowerShell Core 6.0

PowerShell Core 6.0, released on January 10, 2018, marked a pivotal shift in the evolution of PowerShell by transitioning from the Windows-specific .NET Framework to the cross-platform .NET Core runtime, enabling support for Windows, macOS, and operating systems. This change eliminated dependencies on Windows-only components, such as the legacy WMI v1 cmdlets (e.g., Get-WmiObject, Invoke-WmiMethod), which were replaced by the more portable CIM cmdlets for common information model interactions. The runtime pivot to .NET Core, specifically CoreCLR and CoreFX, allowed PowerShell to leverage .NET Standard 2.0 for broader module compatibility while shedding platform-specific ties that confined previous versions to Windows. As a result, PowerShell Core 6.0 became the first fully open-source iteration, hosted on under the , fostering community contributions for cross-platform development. To prioritize cross-platform viability, the cmdlet set in PowerShell Core 6.0 was intentionally reduced, excluding Windows-specific providers and modules that relied on proprietary APIs. For instance, the Certificate provider, essential for managing certificates on Windows, was omitted, as were modules like ActiveDirectory and , which depend on Windows infrastructure. Supported modules were limited to core ones such as Microsoft.PowerShell.Management, Microsoft.PowerShell.Security, Microsoft.PowerShell.Utility, PackageManagement, PowerShellGet, and PSReadLine, ensuring a lean foundation for universal scripting without bloating the distribution with incompatible features. This trimming contrasted with the fuller feature set of Windows PowerShell 5.1, emphasizing portability over comprehensive Windows integration, though it meant some scripts required adaptation for non-Windows environments. Remoting capabilities were expanded in PowerShell Core 6.0 to support cross-platform scenarios through the PowerShell Remoting Protocol (PSRP) over SSH, an experimental feature at launch that enabled session-based interactions between Windows PowerShell and Core instances without relying on (WinRM). This SSH transport facilitated basic remote command execution and session management on and macOS targets, using commands like Enter-PSSession with the -SSHTransport parameter, though it lacked advanced features like just-enough administration () initially. Performance in PowerShell Core 6.0 benefited from the .NET Core runtime's optimizations, including faster startup times and reduced memory footprint compared to .NET Framework-based versions, particularly in loop-heavy scripts and object pipelines. Package management was enhanced via the included PowerShellGet 1.6.0 and PackageManagement 1.1.7 modules, allowing users to discover, install, and update modules from the PowerShell Gallery directly, with improved support for cross-platform artifacts. These advancements laid the groundwork for subsequent iterations like the PowerShell 7.x series.

PowerShell 7.x Series

PowerShell 7.0, released on March 4, 2020, introduced significant enhancements to scripting efficiency and expressiveness. It added support for parallel execution via the ForEach-Object -Parallel cmdlet, allowing pipeline elements to be processed concurrently using runspaces for improved performance in data-heavy tasks. Additionally, the ternary operator (condition ? trueValue : falseValue) was implemented to enable concise conditional expressions, reducing the need for verbose if-else statements. Pipeline chain operators (&& for success chaining and || for failure chaining) were also added, facilitating conditional command execution based on the exit code of preceding commands. Subsequent releases from 7.1 to 7.3 built on this foundation with refinements to core features and integration with evolving .NET runtimes. PowerShell 7.1, released on November 11, 2020, and based on .NET 5, incorporated enhancements to ForEach-Object -Parallel, including better throttle limiting and error handling for more robust parallel workflows. The PowerShell SecretManagement module was introduced in this series, providing a unified interface for storing, retrieving, and managing secrets across vault extensions like Azure Key Vault or local stores, with general availability achieved in March 2021. PowerShell 7.2, an LTS release on November 8, 2021, running on .NET 6, further optimized parallel foreach operations with improved resource management. PowerShell 7.3, released on November 9, 2022, and powered by .NET 7, added support for advanced .NET features like enhanced garbage collection, contributing to overall performance gains in parallel execution scenarios. PowerShell 7.4, designated as an LTS version and released on November 16, 2023, integrated with .NET 8 for broader cross-platform compatibility and performance optimizations derived from the runtime's advancements in and . This release maintains a dedicated stream, ensuring security updates and critical fixes until November 10, 2026, to support enterprise environments requiring stability. PowerShell 7.5, released on January 23, 2025, is built on , leveraging its improvements in application startup times and other performance enhancements. Build processes were refined with updated tooling for cross-platform packaging. As of October 2025, the latest patch is PowerShell 7.5.4.

Implementation

Platform Support and Installation

PowerShell 7.x is a cross-platform automation solution supported on SP1 and later, including , , , and subsequent versions, as well as various distributions and macOS. On , it supports , , (RHEL) versions 7 through 10, (excluding interim releases such as 25.04), and other distributions like and where .NET is available. For macOS, PowerShell 7 and higher requires macOS 13 (Ventura) or later, with support extending to macOS 15 () and beyond on both x64 and Arm64 architectures. Installation methods vary by platform to facilitate easy deployment. On Windows, users can install PowerShell 7.x via the package downloaded from the official releases, the Winget package manager (e.g., winget install --id Microsoft.PowerShell), or the app. For Linux, package managers such as APT for and (after adding the repository), DNF or YUM for RHEL and , and Zypper for are recommended, with binary archives (.tar.gz) available as an alternative. On macOS, installation is supported through Homebrew (brew install --cask powershell), a .pkg installer from , or as a .NET global tool if the .NET SDK is present. PowerShell 7.x installs side-by-side with the legacy Windows PowerShell 5.1 on Windows systems, allowing both to coexist without conflicts and enabling seamless migration testing. PowerShell 7.x relies on the .NET runtime for execution, with specific versions required based on the PowerShell release; for instance, PowerShell 7.5 necessitates .NET 9, while earlier versions like 7.4 use .NET 8. The .NET runtime must be installed separately on non-Windows platforms if not bundled with the package manager installation, ensuring compatibility with the target operating system's supported .NET versions. For containerized environments, official Docker images are provided by in the Microsoft Container Registry (MCR), supporting base images like , , and Core, allowing PowerShell to run in isolated containers (e.g., docker run -it mcr.microsoft.com/powershell:latest). In cloud deployments, PowerShell is natively available in Cloud Shell for managing resources and can be installed via AWS Tools for PowerShell on Machine Images (AMIs), with modules like AWS.Tools.Installer facilitating setup on EC2 instances. Version-specific support lifecycles align with .NET and OS end-of-support dates, such as PowerShell 7.4 as the current LTS release until November 2026.

Filename Extensions and Configuration

PowerShell utilizes specific filename extensions to denote various file types associated with its scripting and modular components. The .ps1 extension is used for PowerShell scripts, which are plain text files containing one or more PowerShell commands for task automation. Script modules employ the .psm1 extension; these files encapsulate functions and code that can be imported into sessions, distinguishing them from standard scripts by their modular purpose. Module manifests, which describe a module's contents, required metadata, and processing instructions, are stored in .psd1 files as PowerShell data files. Additionally, session configuration files use the .pssc extension to define settings for remote or custom PowerShell sessions, such as those created via the New-PSSessionConfigurationFile cmdlet. Security is managed through execution policies that control script execution conditions. The Set-ExecutionPolicy cmdlet modifies these policies, with options including Restricted, which prevents all scripts from running, and RemoteSigned, which allows local scripts but requires remote ones to be signed by a trusted publisher. These policies help mitigate risks from untrusted code while enabling legitimate automation. Customization occurs via profile scripts and preference variables. The PROFILE automatic variable points to user-specific profile files, such as Microsoft.PowerShell_profile.ps1, which execute at session startup to set aliases, functions, [environment](/page/Environment) variables, and other [environment](/page/Environment) tweaks. For instance, profiles can define [environment](/page/Environment) variables like env:PATH to extend command availability. Error handling presentation is configurable through the $ErrorView preference variable, which supports formats such as ConciseView for streamlined output or CategoryView for categorized details, allowing users to tailor error display without altering behavior. PowerShell 7 introduces powershell.config.json as a loaded at startup for global settings, though many runtime preferences like $ErrorView are typically managed in profiles for session-specific adjustments. This layered approach ensures flexibility in tailoring the environment to individual or organizational needs.

with Other Tools

PowerShell facilitates interoperability with traditional command-line interfaces by allowing invocation through its executable, pwsh.exe, from environments such as Command Prompt (CMD) on Windows or on systems. On Windows, users can launch PowerShell 7 from CMD by typing pwsh followed by optional parameters, such as -Command to execute inline code or -File to run a file; for example, pwsh -Command "Get-Process" retrieves running processes directly from a CMD session. Similarly, on or macOS, Bash users invoke it via ./pwsh or by adding it to the , enabling seamless integration for hybrid scripting workflows where Bash handles file operations and PowerShell manages .NET interactions. For deeper integration, PowerShell's can be embedded into applications written in other languages, leveraging its .NET foundation. In applications, the pythonnet package enables hosting the PowerShell engine directly, allowing scripts to execute PowerShell cmdlets within a Python context; this requires installing pythonnet via and initializing the with clr.AddReference('System.Management.Automation') before invoking commands like PowerShell.Create().AddScript('Get-Date').Invoke(). Requirements include 3.6+ and a compatible .NET , facilitating tasks such as where 's libraries complement PowerShell's system administration capabilities. In , the node-powershell package provides a to run PowerShell scripts synchronously or asynchronously, using child processes or direct invocation; for instance, const { PowerShell } = require('node-powershell'); const ps = new PowerShell({ executionPolicy: 'Bypass', noProfile: true }); sets up a session for executing commands like retrieving system information. This approach supports cross-platform embedding, though it relies on the underlying .NET Core for PowerShell 7. PowerShell integrates with web services through the Invoke-RestMethod cmdlet, which simplifies HTTP/HTTPS requests to APIs by automatically parsing responses into PowerShell objects. Key parameters include -Uri for the endpoint, -Method for HTTP verbs (e.g., GET, POST), -Headers for authentication, and -Body for request payloads; for example, Invoke-RestMethod -Uri 'https://api.example.com/data' -Method Get fetches and deserializes data into a structured object without manual parsing. handling is native via ConvertTo-Json and ConvertFrom-Json, where ConvertTo-Json serializes .NET objects to strings with options for depth control (e.g., -Depth 3), and ConvertFrom-Json parses strings back to PSObjects or Hashtables, enabling easy manipulation of responses in pipelines. These cmdlets ensure robust interoperability with modern , supporting features like authentication tokens and error handling for production scenarios. To bridge legacy scripts, PowerShell 7 includes the Windows PowerShell feature, which uses implicit remoting to and execute Windows PowerShell 5.1 and scripts in a cross-version environment. Enabled by importing the Microsoft.PowerShell.Windows.[Compatibility](/page/Compatibility) module (e.g., Import-Module Microsoft.PowerShell.Windows.[Compatibility](/page/Compatibility)), it proxies calls to a background Windows PowerShell session, allowing unmodified scripts to run on non-Windows platforms or alongside PowerShell 7. This layer maintains for like , though some Windows-specific behaviors may differ, and it requires Windows PowerShell 5.1 to be installed on the host system. Historically, served as an open-source .NET/Mono implementation of PowerShell for non-Windows platforms, aiming to provide a hostable scripting for systems before official cross-platform support. Released in 2008, it reimplemented core cmdlets but remained incomplete and was archived in 2019 following the open-sourcing of PowerShell Core, rendering it of limited current relevance as users now adopt the official implementation.

Usage and Comparisons

Key Applications and Integrations

PowerShell serves as a primary tool for system administration in Windows environments, enabling administrators to manage Domain Services through dedicated cmdlets that handle user, group, and computer object operations. For instance, cmdlets like Get-ADUser and New-ADUser allow querying and creating user accounts efficiently, streamlining domain management tasks. Similarly, the IISAdministration module provides cmdlets for configuring and monitoring (IIS) web servers, such as Get-IISSite for retrieving site information and New-IISSite for creating new websites, facilitating automated web server deployment and maintenance. In , the module supports tasks like creating virtual machines with New-VM and managing virtual switches via New-VMSwitch, allowing administrators to automate Hyper-V host operations remotely. In cloud computing, PowerShell integrates deeply with major providers through specialized modules that enable resource provisioning and management from the command line. The PowerShell module, known as , offers cmdlets for interacting with Azure services, including virtual machines, storage accounts, and networking resources, supporting automation of cloud infrastructure tasks. For AWS, the AWS Tools for PowerShell provide over 1,000 cmdlets built on the AWS SDK for .NET, allowing users to script operations like launching EC2 instances with New-EC2Instance or managing S3 buckets via Write-S3Object, thus bridging Windows administration with AWS environments. PowerShell plays a key role in practices, particularly in and (CI/CD) workflows. In , the PowerShell task (PowerShell@2) executes scripts within pipelines to perform build, test, and deployment actions, such as applying versioned configurations or integrating with resources. For Actions, PowerShell scripts can be run in workflows to automate testing with tools like Pester, install module dependencies, and publish artifacts, enhancing cross-platform for repositories hosted on . For security, Just Enough Administration (JEA) in PowerShell enables by restricting sessions to specific cmdlets and parameters, reducing the risk of over-privileged operations. Administrators can define role capabilities files to limit actions, such as allowing only password resets via approved cmdlets, thereby implementing the principle of least privilege in delegated administration scenarios.

Comparison with Traditional Shells

PowerShell distinguishes itself from traditional shells like Bash and the Windows Command Prompt (CMD) primarily through its object-oriented pipeline, which processes .NET objects rather than text streams. In contrast, Bash and CMD rely on text-based pipelines where output from one command is parsed as strings, often requiring additional tools like grep or awk for filtering. This object model in PowerShell enables richer data manipulation without formatting loss, as properties and methods of objects can be directly accessed downstream in the pipeline. The following table illustrates key differences in pipeline handling between PowerShell and text-based shells:
AspectPowerShell (Object )Bash/CMD (Text )
Data Type.NET objects with (e.g., processes as objects with CPU, ID) output (e.g., lines of text)
Example Command`Get-ProcessWhere-Object {$_.CPU -gt 1000}` (filters processes by CPU usage )
Filtering EfficiencyDirect access; no neededRequires text matching; prone to formatting issues
Output PreservationRetains object for further commandsConverts to text, losing unless reformatted
Cmdlets in PowerShell provide equivalents to common commands in traditional shells, facilitating familiarity while leveraging the object model. For instance, Get-ChildItem serves as the counterpart to ls in or dir in CMD, listing directory contents as objects with accessible properties like Name, Length, and LastWriteTime. Additionally, Set-Alias allows users to create shortcuts, such as mapping ll to Get-ChildItem -Force for a detailed listing similar to 's ls -l. PowerShell excels in Windows and .NET environments due to its native integration with the .NET Framework and , enabling seamless access to (WMI) and (COM) objects for administrative tasks. However, on systems, portability faces challenges such as differing path separators (forward slashes vs. backslashes), case-sensitive file systems, and limited support for certain Windows-specific cmdlets, requiring adaptations for cross-platform scripting. Hybrid environments bridge these gaps, with PowerShell installable directly in Windows Subsystem for Linux (WSL) to run alongside , allowing scripts to invoke Linux commands from PowerShell via wsl or vice versa. Conversely, WSL enables execution within Windows, supporting mixed workflows for developers managing both ecosystems.