Private/Get-MdlsValue.ps1
|
function Get-MdlsValue { param( [string]$Path, [string]$Key ) if (-not (Test-Path -LiteralPath $Path)) { return "" } $raw = /usr/bin/mdls -raw -name $Key "$Path" 2>$null if ([string]::IsNullOrWhiteSpace($raw) -or $raw -eq "(null)") { return "" } return ($raw -replace '^\(|\)$', '' -replace '"', '').Trim() } |