mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 16:33:20 +01:00
Improve list-profiles.ps1
This commit is contained in:
parent
7e476ca1cb
commit
b078b794e3
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX list-profiles.ps1
|
.SYNTAX list-profiles.ps1
|
||||||
.DESCRIPTION lists your PowerShell profiles
|
.DESCRIPTION lists your PowerShell profiles
|
||||||
@ -6,25 +6,23 @@
|
|||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function ShowProfile { param([int]$Level, [string]$Name, [string]$Filename)
|
function ShowProfile { param([string]$Level, [string]$Name, [string]$Filename)
|
||||||
write-output "Level: $Level"
|
"$Level Profile '$Name'"
|
||||||
write-output "Name: $Name"
|
|
||||||
if (test-path "$Filename") {
|
if (test-path "$Filename") {
|
||||||
write-output "File: $Filename"
|
" at $Filename"
|
||||||
} else {
|
} else {
|
||||||
write-output "File: $Filename (file missing)"
|
" at $Filename (file missing)"
|
||||||
}
|
}
|
||||||
write-output ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
write-output ""
|
ShowProfile "1" "AllUsersAllHosts" $PROFILE.AllUsersAllHosts
|
||||||
write-output "PowerShell Profiles"
|
""
|
||||||
write-output "==================="
|
ShowProfile "2" "AllUsersCurrentHost" $PROFILE.AllUsersCurrentHost
|
||||||
ShowProfile 1 "AllUsersAllHosts" $PROFILE.AllUsersAllHosts
|
""
|
||||||
ShowProfile 2 "AllUsersCurrentHost" $PROFILE.AllUsersCurrentHost
|
ShowProfile "3" "CurrentUserAllHosts" $PROFILE.CurrentUserAllHosts
|
||||||
ShowProfile 3 "CurrentUserAllHosts" $PROFILE.CurrentUserAllHosts
|
""
|
||||||
ShowProfile 4 "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
|
ShowProfile "4" "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user