PowerShell Platform Compatibility

Maps which PowerShell commands work on Windows only vs cross-platform with PowerShell 7 on Linux. Essential for knowing when to reach for PowerShell vs bash on Linux hosts.

Platform Compatibility

Cross-Platform (Windows + PowerShell 7 on Linux)

These work identically on both platforms:

Domain Key Commands

Pipelines

Where-Object, Select-Object, Sort-Object, ForEach-Object, Group-Object, Measure-Object

Strings & Regex

-match, -replace, -split, Select-String, [regex]::Match()

Here-Strings

@" "@, @' '@ — same syntax everywhere

Error Handling

try/catch/finally, $ErrorActionPreference, $Error[]

Jobs

Start-Job, Receive-Job, ForEach-Object -Parallel (PS 7+)

Modules

Install-Module, Import-Module, PSGallery

PSObjects

Get-Member, [PSCustomObject]@{}, calculated properties

JSON/CSV

ConvertTo-Json, ConvertFrom-Json, Export-Csv, Import-Csv

SSH Remoting

Enter-PSSession -HostName -SSHTransport (PS 7+)

File I/O

Get-Content, Set-Content, Get-ChildItem, Test-Path

Windows Only

These require Windows or RSAT — they will not work on PowerShell 7 Linux:

Domain Key Commands

Active Directory

Get-ADUser, Get-ADGroup, Get-ADComputer — requires RSAT ActiveDirectory module

Group Policy

Get-GPO, Get-GPResultantSetOfPolicy — requires GroupPolicy module

WMI/CIM

Get-CimInstance Win32_* — Win32 classes are Windows-only

Certificate Store

Get-ChildItem Cert:\ — Windows certificate provider

802.1X / WiFi

netsh wlan, netsh lan, dot3svc, Wlansvc — Windows network stack

Registry

Get-ItemProperty HKLM:\ — Windows registry provider

WinRM Remoting

Enter-PSSession -ComputerName (WSMan transport) — use SSH transport on Linux

Windows Events

Get-WinEvent, Get-EventLog — Windows event log system

Firewall (Windows)

Get-NetFirewallRule, New-NetFirewallRule — Windows Firewall module

The Crossover Pattern

When you know the Windows command, here’s the Linux equivalent approach:

Task Windows PowerShell PowerShell 7 on Linux

Remote session

Enter-PSSession -ComputerName srv01

Enter-PSSession -HostName srv01 -SSHTransport

System info

Get-CimInstance Win32_OperatingSystem

uname -a (use bash, not PS for this)

Service status

Get-Service -Name sshd

systemctl status sshd (bash)

Certificate check

Get-ChildItem Cert:\LocalMachine\My

openssl x509 -in cert.pem -noout -text

Event logs

Get-WinEvent -LogName System

journalctl -u sshd (bash)

Network config

Get-NetIPConfiguration

ip -j addr (bash + jq)

See Also