Files
Resolve-DSCConfigurationData/Private/ConvertTo-ConfigurationDataExpressionBoolean.ps1
Torsten Brendgen 4b83abc7f2 initial Commit
2026-06-27 00:36:04 +02:00

34 lines
580 B
PowerShell

function ConvertTo-ConfigurationDataExpressionBoolean {
[CmdletBinding()]
Param(
[AllowNull()]
$Value
)
if($null -eq $Value){
return $false
}
if($Value -is [bool]){
return $Value
}
if($Value -is [int]){
return $Value -ne 0
}
if($Value -is [string]){
if($Value -match "^(?i:true|false)$"){
return [bool]::Parse($Value)
}
return $Value.Length -gt 0
}
if($Value -is [System.Array]){
return @($Value).Count -gt 0
}
return [bool]$Value
}