diff --git a/System Info (ps1)/Get-SystemSecurityAndHardwareInfo.ps1 b/System Info (ps1)/Get-SystemSecurityAndHardwareInfo.ps1 index 7b2c637..f2c2379 100644 --- a/System Info (ps1)/Get-SystemSecurityAndHardwareInfo.ps1 +++ b/System Info (ps1)/Get-SystemSecurityAndHardwareInfo.ps1 @@ -28,7 +28,14 @@ function Get-TPMStatus { if ($g.SpecVersion) { $spec = ($g.SpecVersion -join ', ') } elseif ($g.SpecVersion -ne $null) { $spec = [string]$g.SpecVersion } $manVer = $null try { if ($g.ManufacturerVersion) { $manVer = $g.ManufacturerVersion } } catch { } - return @{ Installed = ($g.TpmPresent -eq $true); IsEnabled = ($g.TpmReady -eq $true); ManufacturerId = $g.ManufacturerId; SpecVersion = $spec; ManufacturerVersion = $manVer } + # Normalize spec version: make a raw string and extract primary (first) component + $specRaw = $null + $specPrimary = $null + if ($spec) { + if ($spec -is [System.Array]) { $specRaw = ($spec -join ', ') } else { $specRaw = [string]$spec } + $specPrimary = ($specRaw -split ',')[0].Trim() + } + return @{ Installed = ($g.TpmPresent -eq $true); IsEnabled = ($g.TpmReady -eq $true); ManufacturerId = $g.ManufacturerId; SpecVersionPrimary = $specPrimary; SpecVersionRaw = $specRaw; ManufacturerVersion = $manVer } } } catch { } @@ -36,11 +43,14 @@ function Get-TPMStatus { try { $tpm = Get-CimInstance -Namespace "root\cimv2\security\microsofttpm" -ClassName Win32_Tpm -ErrorAction Stop if ($tpm -and $tpm.IsEnabled_InitialValue -ne $null) { - $spec = $null - try { if ($tpm.SpecVersion) { $spec = ($tpm.SpecVersion -join ', ') } } catch { $spec = $tpm.SpecVersion } + $specRaw = $null + try { + if ($tpm.SpecVersion -is [System.Array]) { $specRaw = ($tpm.SpecVersion -join ', ') } else { $specRaw = [string]$tpm.SpecVersion } + } catch { $specRaw = [string]$tpm.SpecVersion } + $specPrimary = if ($specRaw) { ($specRaw -split ',')[0].Trim() } else { $null } $manVer = $null try { if ($tpm.ManufacturerVersion) { $manVer = $tpm.ManufacturerVersion } } catch { } - return @{ Installed = $true; IsEnabled = ($tpm.IsActivated_InitialValue -eq $true) -or ($tpm.IsEnabled_InitialValue -eq $true); ManufacturerId = $tpm.ManufacturerID; SpecVersion = $spec; ManufacturerVersion = $manVer } + return @{ Installed = $true; IsEnabled = ($tpm.IsActivated_InitialValue -eq $true) -or ($tpm.IsEnabled_InitialValue -eq $true); ManufacturerId = $tpm.ManufacturerID; SpecVersionPrimary = $specPrimary; SpecVersionRaw = $specRaw; ManufacturerVersion = $manVer } } } catch { # fallback to registry check @@ -214,9 +224,11 @@ function Format-ResultText($res) { $lines += "TPM Enabled/Activated: $($res.TPM.IsEnabled)" if ($res.TPM.ManufacturerId) { $lines += "TPM ManufacturerId: $($res.TPM.ManufacturerId)" } $manVer = if ($res.TPM.ManufacturerVersion) { $res.TPM.ManufacturerVersion } else { 'Not detected' } - $specVer = if ($res.TPM.SpecVersion) { $res.TPM.SpecVersion } else { 'Not detected' } + $specPrimary = if ($res.TPM.SpecVersionPrimary) { $res.TPM.SpecVersionPrimary } else { 'Not detected' } + $specRaw = if ($res.TPM.SpecVersionRaw) { $res.TPM.SpecVersionRaw } else { 'Not detected' } $lines += "TPM ManufacturerVersion: $manVer" - $lines += "TPM SpecVersion: $specVer" + $lines += "TPM SpecVersion (primary): $specPrimary" + $lines += "TPM SpecVersion (raw): $specRaw" $lines += "" $sb = $res.SecureBoot if ($sb -eq $null) { $lines += "Secure Boot: Unknown (insufficient privileges or unsupported)" } else { $lines += "Secure Boot Enabled: $sb" } diff --git a/System Info (ps1)/README.md b/System Info (ps1)/README.md index 4b541d3..aa22b65 100644 --- a/System Info (ps1)/README.md +++ b/System Info (ps1)/README.md @@ -62,12 +62,11 @@ pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1 -OutputFile report.txt - Download and run directly from a raw GitHub URL (only if you trust the URL): - Execute directly (preferred when you trust the source): -# Option A (safest single-line): fetch only the script text and pipe into pwsh for execution. ```powershell +# Option A (safest single-line): fetch only the script text and pipe into pwsh for execution. (iwr -UseBasicParsing "https://git.smartcraft.me/Smartcraft-Media-Tech/System-Info/raw/branch/master/System%20Info%20%28ps1%29/Get-SystemSecurityAndHardwareInfo.ps1").Content | & pwsh -Command - -``` + # Option B (forces pwsh, similar to above but uses the response pipeline): -``` iwr -UseBasicParsing "https://git.smartcraft.me/Smartcraft-Media-Tech/System-Info/raw/branch/master/System%20Info%20%28ps1%29/Get-SystemSecurityAndHardwareInfo.ps1" | & pwsh -Command - ```