PowerShell_Scripts/base/Get-Profiles.ps1

16 lines
521 B
PowerShell
Raw Normal View History

[CmdletBinding()]param(
[switch]$AsDictionary
)
2022-01-29 21:35:26 +00:00
filter ConvertTo-Hash { param([string]$Property='Name') begin { $hash = @{} } process{ $hash[$_."$Property"] = $_ } end {return $hash} }
2022-01-29 21:35:26 +00:00
$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