14 lines
549 B
PowerShell
14 lines
549 B
PowerShell
|
[CmdletBinding()]param(
|
||
|
[switch]$AsDictionary
|
||
|
)
|
||
|
|
||
|
filter ConvertTo-Hash { param([string]$Property="Name") begin { $hash = @{} } process{ $hash[$_."$Property"] = $_ } end {return $hash} }
|
||
|
|
||
|
$local:rVal = $PROFILE | fl * -Force | Out-String -Stream | Where-Object { $_ -match '( : /)|(:\\)' } |
|
||
|
Select-Object @{
|
||
|
N="Profile";E={($_ -split ": ")[0].Trim()}
|
||
|
},@{N="Path";E={($_ -split ": ")[-1].Trim()}
|
||
|
} | Select-Object *,@{N="Exists";E={Test-Path $_.Path}}
|
||
|
if( $AsDictionary ) { return $rVal | ConvertTo-Hash -Property "Profile" }
|
||
|
return $rVal
|