mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Improve list-automatic-variables.ps1
This commit is contained in:
parent
1451ad4c69
commit
c68ba3d764
@ -6,7 +6,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
function AddItem { param([string]$Variable, [string]$Content)
|
function AddItem { param([string]$Variable, [string]$Content)
|
||||||
New-Object PSObject -Property @{ 'Variable' = "$Variable"; 'Content' = "$Content" }
|
new-object PSObject -property @{ 'Variable' = "$Variable"; 'Content' = "$Content" }
|
||||||
}
|
}
|
||||||
|
|
||||||
function ListAutomaticVariables {
|
function ListAutomaticVariables {
|
||||||
@ -62,10 +62,7 @@ function ListAutomaticVariables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Vars = ListAutomaticVariables
|
ListAutomaticVariables | format-table -property Variable,Content
|
||||||
$Vars | format-table -property Variable,Content
|
|
||||||
|
|
||||||
write-host -foregroundColor green "OK - $($Vars.Count) PowerShell automatic variables total"
|
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user