Private/Test-TechCarePlatform.ps1
|
function Test-TechCarePlatform { <# .SYNOPSIS Indica si la sesion corre sobre Windows. .DESCRIPTION Windows PowerShell 5.1 solo existe en Windows, asi que la edicion Desktop ya responde la pregunta. En PowerShell 7+ se consulta $IsWindows a traves de Get-Variable, porque referenciarlo directamente seria un error de variable inexistente bajo StrictMode al cargar el modulo en 5.1. #> [CmdletBinding()] [OutputType([bool])] param() if ($PSVersionTable.PSEdition -eq 'Desktop') { return $true } if ($PSVersionTable.PSVersion.Major -ge 6) { if (Test-Path -Path 'Variable:IsWindows') { return [bool](Get-Variable -Name 'IsWindows' -ValueOnly) } return ([System.Environment]::OSVersion.Platform -eq 'Win32NT') } return $false } |