2021-04-07 11:53:57 +02:00
|
|
|
#!/usr/bin/pwsh
|
2021-02-24 19:03:31 +01:00
|
|
|
<#
|
2021-04-07 15:17:49 +02:00
|
|
|
.SYNTAX list-profiles.ps1
|
2021-03-22 20:10:18 +01:00
|
|
|
.DESCRIPTION lists your PowerShell profiles
|
|
|
|
.LINK https://github.com/fleschutz/PowerShell
|
|
|
|
.NOTES Author: Markus Fleschutz / License: CC0
|
2021-02-24 19:03:31 +01:00
|
|
|
#>
|
|
|
|
|
2021-02-24 19:44:05 +01:00
|
|
|
function ShowProfile { param([int]$Level, [string]$Name, [string]$Filename)
|
2021-04-07 13:55:58 +02:00
|
|
|
write-output "Level: $Level"
|
|
|
|
write-output "Name: $Name"
|
2021-02-24 19:44:05 +01:00
|
|
|
if (test-path "$Filename") {
|
2021-04-07 13:55:58 +02:00
|
|
|
write-output "File: $Filename"
|
2021-02-24 19:44:05 +01:00
|
|
|
} else {
|
2021-04-07 13:55:58 +02:00
|
|
|
write-output "File: $Filename (file missing)"
|
2021-02-24 19:44:05 +01:00
|
|
|
}
|
|
|
|
write-output ""
|
|
|
|
}
|
2021-02-24 19:03:31 +01:00
|
|
|
|
2021-02-24 19:44:05 +01:00
|
|
|
try {
|
|
|
|
write-output ""
|
|
|
|
write-output "PowerShell Profiles"
|
2021-04-07 13:55:58 +02:00
|
|
|
write-output "==================="
|
2021-02-24 19:44:05 +01:00
|
|
|
ShowProfile 1 "AllUsersAllHosts" $PROFILE.AllUsersAllHosts
|
|
|
|
ShowProfile 2 "AllUsersCurrentHost" $PROFILE.AllUsersCurrentHost
|
|
|
|
ShowProfile 3 "CurrentUserAllHosts" $PROFILE.CurrentUserAllHosts
|
|
|
|
ShowProfile 4 "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
|
2021-02-24 19:03:31 +01:00
|
|
|
exit 0
|
|
|
|
} catch {
|
|
|
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
|
|
exit 1
|
|
|
|
}
|