Skip to main content

Get-KeldorPlatform

SYNOPSIS​

Gets the current operating-system platform.

SYNTAX​

Get-KeldorPlatform [<CommonParameters>]

DESCRIPTION​

Identifies the operating-system family and returns exactly Windows, macOS, Linux, or Unknown.

Get-KeldorPlatform identifies only the operating-system family. It does not return the operating-system edition, distribution, architecture, build, or version. It supports Windows PowerShell 5.1 and supported PowerShell 7 release lines beginning with PowerShell 7.4.

EXAMPLES​

EXAMPLE 1​

Get-KeldorPlatform

Returns the operating-system family for the current PowerShell session.

EXAMPLE 2​

if ((Get-KeldorPlatform) -eq 'Windows') {
Write-Output 'Running on Windows.'
}

Uses the fixed platform contract to run platform-specific logic.

PARAMETERS​

CommonParameters​

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS​

OUTPUTS​

System.String​

NOTES​

ALIASES​

None.

PLATFORM APPLICABILITY​

Windows, macOS, and Linux.

POWERSHELL COMPATIBILITY​

See PowerShell compatibility for the supported runtime policy. PowerShell 7.6 LTS is preferred.

https://docs.keldor.dev/powershell/keldor/Get-KeldorPlatform