16 lines
521 B
PowerShell
16 lines
521 B
PowerShell
[CmdletBinding()]param(
|
|
[switch]$AsDictionary
|
|
)
|
|
|
|
filter ConvertTo-Hash { param([string]$Property='Name') begin { $hash = @{} } process{ $hash[$_."$Property"] = $_ } end {return $hash} }
|
|
|
|
$local:rVal = $PROFILE | Get-Member -Type NoteProperty |
|
|
Select-Object -ExpandProperty Name |
|
|
Select-Object @{
|
|
N='Profile';E={$_}
|
|
},@{N='Path';E={$PROFILE."$_"}
|
|
} |
|
|
Select-Object *,@{N="Exists";E={Test-Path $_.Path}}
|
|
if( $AsDictionary ) { return $rVal | ConvertTo-Hash -Property "Profile" }
|
|
return $rVal
|