Improve list-automatic-variables.ps1

This commit is contained in:
Markus Fleschutz 2021-05-13 12:07:16 +02:00
parent 1451ad4c69
commit c68ba3d764

View File

@ -6,7 +6,7 @@
#>
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 {
@ -62,10 +62,7 @@ function ListAutomaticVariables {
}
try {
$Vars = ListAutomaticVariables
$Vars | format-table -property Variable,Content
write-host -foregroundColor green "OK - $($Vars.Count) PowerShell automatic variables total"
ListAutomaticVariables | format-table -property Variable,Content
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"