From 094fca26658f8bd7506978c29ceb47651cc80797 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 11 Apr 2023 10:26:05 +0200 Subject: [PATCH] Update check-os.ps1 and check-powershell.ps1 --- Scripts/check-os.ps1 | 7 ++++--- Scripts/check-powershell.ps1 | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Scripts/check-os.ps1 b/Scripts/check-os.ps1 index 1f718a60..b8ccb817 100755 --- a/Scripts/check-os.ps1 +++ b/Scripts/check-os.ps1 @@ -5,6 +5,7 @@ This PowerShell script queries and lists operating system details. .EXAMPLE PS> ./check-os + ✅ Windows 10 Pro 64-bit (v10.0.19045, since 6/22/2021, S/N 00123-45678-15135-AAOEM, P/K AB123-CD456-EF789-GH000-WFR6P) .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -14,8 +15,8 @@ try { if ($IsLinux) { $Name = $PSVersionTable.OS - if ([System.Environment]::Is64BitOperatingSystem) { $Bits = "64-bit" } else { $Bits = "32-bit" } - Write-Host "✅ $Name ($Bits)" + if ([System.Environment]::Is64BitOperatingSystem) { $Arch = "64-bit" } else { $Arch = "32-bit" } + Write-Host "✅ $Name $Arch" } else { $OS = Get-WmiObject -class Win32_OperatingSystem $Name = $OS.Caption -Replace "Microsoft Windows","Windows" @@ -29,7 +30,7 @@ try { $InstallDate = $OSDetails.InstallDate $ProductKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" -Name BackupProductKeyDefault).BackupProductKeyDefault - Write-Host "✅ $Name ($Arch, v$Version, S/N $Serial, P/K $ProductKey) since $($InstallDate.ToShortDateString())" + Write-Host "✅ $Name $Arch (v$Version, since $($InstallDate.ToShortDateString()), S/N $Serial, P/K $ProductKey)" } exit 0 # success } catch { diff --git a/Scripts/check-powershell.ps1 b/Scripts/check-powershell.ps1 index c72df6bf..86e0ab78 100644 --- a/Scripts/check-powershell.ps1 +++ b/Scripts/check-powershell.ps1 @@ -1,10 +1,11 @@ <# .SYNOPSIS - Check the PowerShell + Check PowerShell details .DESCRIPTION This PowerShell script queries PowerShell details and lists it. .EXAMPLE PS> ./check-powershell + ✅ PowerShell 5.1.19041.2673 Desktop edition (10 modules, 1458 cmdlets, 172 aliases) .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -17,10 +18,10 @@ try { $NumModules = (Get-Module).Count $NumAliases = (Get-Alias).Count if ($IsLinux) { - $Reply = "✅ PowerShell $Version ($Edition edition, $NumModules modules, $NumAliases aliases)" + $Reply = "✅ PowerShell $Version $Edition edition ($NumModules modules, $NumAliases aliases)" } else { $NumCmdlets = (Get-Command -Command-Type cmdlet).Count - $Reply = "✅ PowerShell $Version ($Edition edition, $NumModules modules, $NumCmdlets cmdlets, $NumAliases aliases)" + $Reply = "✅ PowerShell $Version $Edition edition ($NumModules modules, $NumCmdlets cmdlets, $NumAliases aliases)" } Write-Host $Reply exit 0 # success