List-PowershellProfiles
Lists the PowerShell profiles
function ListProfile { param([int]$prio, [string]$profileName, [string]$Location)
if (Test-Path "$Location") { $Exists = "yes" } else { $Exists = "no" }
New-Object PSObject -Property @{ 'Prio'="$prio"; 'Profile Name'="$profileName"; 'Location'="$Location"; 'Exists'="$Exists" }
}
function ListProfiles {
ListProfile 1 "AllUsersAllHosts" $PROFILE.AllUsersAllHosts
ListProfile 2 "AllUsersCurrentHost" $PROFILE.AllUsersCurrentHost
ListProfile 3 "CurrentUserAllHosts" $PROFILE.CurrentUserAllHosts
ListProfile 4 "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
}
try {
ListProfiles | Format-Table -property Prio,'Profile Name',Exists,Location
exit 0 # success
} catch {
"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}