PowerShell 7.2: What’s New for DevOps

PowerShell 7.2 is the new LTS (Long Term Support) release built on .NET 6. It consolidates the cross-platform story.

ANSI Color Support

PS 7.2 introduces the $PSStyle automatic variable which makes decorating output easier and cross-platform compatible.

Write-Host "$($PSStyle.Background.Red)CRITICAL ERROR$($PSStyle.Reset)"

Parallel ForEach-Object

While introduced earlier, the improvements to ForEach-Object -Parallel in 7.x make it indispensable for DevOps tasks like restarting 50 servers or checking status of 100 endpoints.

$servers | ForEach-Object -Parallel {
    Restart-Computer -ComputerName $_ -Force
} -ThrottleLimit 10

Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.