File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 https://github.com/fleschutz/PowerShell
1212#>
1313
14- function ShowProfile { param ([string ]$Level , [string ]$Name , [string ]$Filename )
15- " $Level Profile '$Name '"
16- if (test-path " $Filename " ) {
17- " at $Filename "
18- } else {
19- " at $Filename (file missing)"
14+ function ListProfile { param ([int ]$Level , [string ]$Profile , [string ]$Location )
15+ if (test-path " $Location " ) { $Existent = " yes" } else { $Existent = " no" }
16+ new-object PSObject - Property @ {
17+ ' Level' = " $Level "
18+ ' Profile' = " $Profile "
19+ ' Location' = " $Location "
20+ ' Existent' = " $Existent "
2021 }
2122}
2223
24+ function ListProfiles {
25+ ListProfile 1 " AllUsersAllHosts" $PROFILE.AllUsersAllHosts
26+ ListProfile 2 " AllUsersCurrentHost" $PROFILE.AllUsersCurrentHost
27+ ListProfile 3 " CurrentUserAllHosts" $PROFILE.CurrentUserAllHosts
28+ ListProfile 4 " CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
29+ }
30+
31+
2332try {
24- ShowProfile " 1" " AllUsersAllHosts" $PROFILE.AllUsersAllHosts
25- " "
26- ShowProfile " 2" " AllUsersCurrentHost" $PROFILE.AllUsersCurrentHost
27- " "
28- ShowProfile " 3" " CurrentUserAllHosts" $PROFILE.CurrentUserAllHosts
29- " "
30- ShowProfile " 4" " CurrentUserCurrentHost" $PROFILE.CurrentUserCurrentHost
33+ ListProfiles | format-table - property Level, Profile, Location, Existent
3134 exit 0
3235} catch {
3336 write-error " ⚠️ Error in line $ ( $_.InvocationInfo.ScriptLineNumber ) : $ ( $Error [0 ]) "
You can’t perform that action at this time.
0 commit comments