Files
System-Info/System Info (ps1)/README.md
minster586 17c8449d89 fix url
2025-10-14 23:36:01 -04:00

75 lines
3.0 KiB
Markdown

# 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 `-OutFile` or provide `-FilePath`.
Requirements
- Windows 10/11 (modern Windows builds). Some checks may require administrative privileges.
- PowerShell 5.1 or PowerShell 7+. `Confirm-SecureBootUEFI` is 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:
```powershell
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1
```
Run and write to a timestamped file in the script folder:
```powershell
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1 -OutputFile report.txt
```
Run and write to a specific file:
```powershell
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):
```powershell
# 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):
```powershell
iwr -UseBasicParsing "https://git.smartcraft.me/Smartcraft-Media-Tech/System-Info/raw/branch/master/System%20Info%20%28ps1%29/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:
```powershell
iwr -OutFile .\Get-SystemSecurityAndHardwareInfo.ps1 "https://git.smartcraft.me/Smartcraft-Media-Tech/System-Info/raw/branch/master/System%20Info%20%28ps1%29/Get-SystemSecurityAndHardwareInfo.ps1"
# Inspect the file, then run:
pwsh.exe -File .\Get-SystemSecurityAndHardwareInfo.ps1 -OutputFile my_report.txt
```