mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Update list-profiles.ps1
This commit is contained in:
parent
b929978ad0
commit
ff545d827e
@ -2,9 +2,16 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
list-profiles.ps1
|
list-profiles.ps1
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Lists your PowerShell profiles
|
Lists your PowerShell profiles.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./list-profiles
|
PS> ./list-profiles
|
||||||
|
|
||||||
|
Level Profile Location Existent
|
||||||
|
----- ------- -------- --------
|
||||||
|
1 AllUsersAllHosts /opt/PowerShell/profile.ps1 no
|
||||||
|
2 AllUsersCurrentHost /opt/PowerShell/Microsoft.PowerShell_profile.ps1 no
|
||||||
|
3 CurrentUserAllHosts /home/markus/.config/powershell/profile.ps1 no
|
||||||
|
4 CurrentUserCurrentHost /home/markus/.config/powershell/Microsoft.PowerShell_profile.ps1 yes
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz · License: CC0
|
Author: Markus Fleschutz · License: CC0
|
||||||
.LINK
|
.LINK
|
||||||
@ -13,12 +20,7 @@
|
|||||||
|
|
||||||
function ListProfile { param([int]$Level, [string]$Profile, [string]$Location)
|
function ListProfile { param([int]$Level, [string]$Profile, [string]$Location)
|
||||||
if (test-path "$Location") { $Existent = "yes" } else { $Existent = "no" }
|
if (test-path "$Location") { $Existent = "yes" } else { $Existent = "no" }
|
||||||
new-object PSObject -Property @{
|
New-Object PSObject -Property @{ 'Level'="$Level"; 'Profile'="$Profile"; 'Location'="$Location"; 'Existent'="$Existent" }
|
||||||
'Level' = "$Level"
|
|
||||||
'Profile' = "$Profile"
|
|
||||||
'Location' = "$Location"
|
|
||||||
'Existent' = "$Existent"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ListProfiles {
|
function ListProfiles {
|
||||||
@ -28,7 +30,6 @@ function ListProfiles {
|
|||||||
ListProfile 4 "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
|
ListProfile 4 "CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ListProfiles | format-table -property Level,Profile,Location,Existent
|
ListProfiles | format-table -property Level,Profile,Location,Existent
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user