main
Bryan Cerrati 2025-06-26 13:44:04 -04:00
parent 5c2206c1a4
commit 066ee51dca
1 changed files with 18 additions and 15 deletions

View File

@ -1,17 +1,19 @@
$remoteComputer = "REMOTE-PC-NAME" $remoteComputer = "REMOTE-PC-NAME"
Invoke-Command -ComputerName $remoteComputer -ScriptBlock { Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
$results = @{} $results = [ordered]@{}
# CPU Check # CPU Check
$cpu = Get-WmiObject Win32_Processor $cpu = Get-WmiObject Win32_Processor
$results["CPU"] = $cpu.Name $cpuName = $cpu | Select-Object -ExpandProperty Name
$results["CPU"] = $cpuName
$results["CPU Present"] = $true $results["CPU Present"] = $true
# RAM Check # RAM Check
$ram = [math]::Round((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2) $ramBytes = (Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory
$results["RAM (GB)"] = $ram $ramGB = [math]::Round($ramBytes / 1GB, 2)
$results["RAM >= 4GB"] = $ram -ge 4 $results["RAM (GB)"] = $ramGB
$results["RAM >= 4GB"] = $ramGB -ge 4
# TPM Check # TPM Check
try { try {
@ -25,10 +27,11 @@ Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
# Partition Style # Partition Style
try { try {
$disk = Get-Disk | Where-Object { $_.IsSystem -eq $true } $disk = Get-Disk | Where-Object { $_.IsSystem -eq $true } | Select-Object -First 1
$results["Partition Style"] = $disk.PartitionStyle $results["Partition Style"] = $disk.PartitionStyle
$results["Disk is GPT"] = $disk.PartitionStyle -eq 'GPT' $results["Disk is GPT"] = $disk.PartitionStyle -eq 'GPT'
} catch { } catch {
$results["Partition Style"] = "Unknown"
$results["Disk is GPT"] = $false $results["Disk is GPT"] = $false
} }
@ -51,24 +54,24 @@ Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
} }
# Final Verdict # Final Verdict
$eligibilityChecks = @("CPU Present", "RAM >= 4GB", "TPM Present", "TPM Ready (2.0)", "Disk is GPT", "UEFI Boot")
$eligible = $true $eligible = $true
foreach ($check in @("CPU Present", "RAM >= 4GB", "TPM Present", "TPM Ready (2.0)", "Disk is GPT", "UEFI Boot")) { foreach ($key in $eligibilityChecks) {
if ($results[$check] -ne $true) { if (-not $results[$key]) {
$eligible = $false $eligible = $false
} }
} }
# Display Results # Output results cleanly
Write-Host "Windows 11 Readiness Check for: $env:COMPUTERNAME" -ForegroundColor Cyan Write-Host "`nWindows 11 Readiness Check for: $env:COMPUTERNAME" -ForegroundColor Cyan
$results.GetEnumerator() | Sort-Object Name | ForEach-Object { foreach ($key in $results.Keys) {
$label = "{0,-25}:" -f $_.Key Write-Host ("{0,-25}: {1}" -f $key, $results[$key])
Write-Host "$label $_.Value"
} }
Write-Host "`nFinal Result: " -NoNewline Write-Host "`nFinal Result: " -NoNewline
if ($eligible) { if ($eligible) {
Write-Host "YES – This machine is eligible for Windows 11." -ForegroundColor Green Write-Host "YES: This machine is eligible for Windows 11." -ForegroundColor Green
} else { } else {
Write-Host "NO – This machine is NOT eligible for Windows 11." -ForegroundColor Red Write-Host "NO: This machine is NOT eligible for Windows 11." -ForegroundColor Red
} }
} }