Get-SystemSecurityAndHardwareInfo.ps1
This PowerShell script gathers several system security and hardware details on Windows:
- TPM installed and enabled/activated status
- Secure Boot enabled status
- Installed RAM (GB and bytes)
- CPU model, manufacturer, core/logical counts, max clock
- Main drive (system drive) size and free space
Features
- Prints results to the console.
- Optional: write results to a timestamped text file in the script folder with
-OutFileor provide-FilePath.
Requirements
- Windows 10/11 (modern Windows builds). Some checks may require administrative privileges.
- PowerShell 5.1 or PowerShell 7+.
Confirm-SecureBootUEFIis available only on UEFI systems and may require admin. - PowerShell 5.1 or PowerShell 7+. For detailed CPU instruction-set detection the script uses built-in .NET intrinsics (System.Runtime.Intrinsics) which are available when running under PowerShell 7+ (PowerShell Core). No third-party tools or native helpers are required.
Usage
Open PowerShell (recommended: run as Administrator for more reliable TPM/Secure Boot detection).
Examples:
Run and show results in console only:
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1
Run and write to a timestamped file in the script folder:
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1 -OutputFile report.txt
Run and write to a specific file:
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1 -OutputFile C:\temp\myreport.txt
Notes
- CPU instruction set detection is limited in this script; it reports CPU name and counts reliably. For detailed CPUID flags, additional native tooling or modules would be needed.
- If output shows Unknown for Secure Boot or TPM, try running PowerShell as Administrator.
License
- Public domain / use as you like.
Quick copy-paste examples
The following are ready-to-copy PowerShell one-liners. Only use the remote download-and-run example if you trust the source. Running code directly from the internet (the iwr | iex pattern) executes whatever is fetched.
- Run the script locally (recommended):
# From the folder that contains the script
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1 -OutputFile report.txt
- Download and run directly from a raw GitHub URL (only if you trust the URL):
# Example using the iwr | iex pattern you provided (replace URL with this repo's raw file URL when publishing):
iwr -UseBasicParsing https://raw.githubusercontent.com/<your-user>/<your-repo>/main/Get-SystemSecurityAndHardwareInfo.ps1 | iex
Security note: iwr | iex downloads and immediately executes code from the given URL. Only run such commands for sources you fully trust. A safer approach is to download the file, inspect it, then execute it locally:
iwr -OutFile .\Get-SystemSecurityAndHardwareInfo.ps1 https://raw.githubusercontent.com/<your-user>/<your-repo>/main/Get-SystemSecurityAndHardwareInfo.ps1
# Inspect the file, then run:
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1 -OutputFile my_report.txt