Update check-powershell.ps1

This commit is contained in:
Markus Fleschutz 2023-04-17 21:33:22 +02:00
parent e1e301ebc7
commit 9b8bd116e6

View File

@ -5,7 +5,7 @@
This PowerShell script queries the PowerShell status and prints it.
.EXAMPLE
PS> ./check-powershell
PowerShell 5.1.19041.2673 Desktop edition (10 modules, 1458 cmdlets, 172 aliases)
PowerShell Desktop edition 5.1.19041.2673 (10 modules, 1458 cmdlets, 172 aliases)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -18,14 +18,13 @@ try {
$NumModules = (Get-Module).Count
$NumAliases = (Get-Alias).Count
if ($IsLinux) {
$Reply = "✅ PowerShell $Version $Edition edition ($NumModules modules, $NumAliases aliases)"
"✅ PowerShell $Edition edition $Version ($NumModules modules, $NumAliases aliases)"
} else {
$NumCmdlets = (Get-Command -Command-Type cmdlet).Count
$Reply = "✅ PowerShell $Version $Edition edition ($NumModules modules, $NumCmdlets cmdlets, $NumAliases aliases)"
"✅ PowerShell $Edition edition $Version ($NumModules modules, $NumCmdlets cmdlets, $NumAliases aliases)"
}
Write-Host $Reply
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}