Updated some check-*.ps1 scripts

This commit is contained in:
Markus Fleschutz
2023-01-01 19:22:35 +01:00
parent f71ce2419d
commit 0cef271a29
13 changed files with 82 additions and 74 deletions

View File

@ -15,7 +15,7 @@ try {
if ($IsLinux) {
$Name = $PSVersionTable.OS
if ([System.Environment]::Is64BitOperatingSystem) { $Bits = "64-bit" } else { $Bits = "32-bit" }
"$Name ($Bits)"
Write-Host "$Name ($Bits)"
} else {
$OS = Get-WmiObject -class Win32_OperatingSystem
$Name = $OS.Caption -Replace "Microsoft Windows","Windows"
@ -29,10 +29,10 @@ try {
$InstallDate = $OSDetails.InstallDate
$ProductKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" -Name BackupProductKeyDefault).BackupProductKeyDefault
"$Name ($Arch, v$Version, S/N $Serial, P/K $ProductKey) since $($InstallDate.ToShortDateString())"
Write-Host "$Name ($Arch, v$Version, S/N $Serial, P/K $ProductKey) since $($InstallDate.ToShortDateString())"
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}