WindowsUpgradeChecker/upgradechecker_remote2.ps1

75 lines
2.3 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

$remoteComputer = "REMOTE-PC-NAME"
Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
$results = @{}
# CPU Check
$cpu = Get-WmiObject Win32_Processor
$results["CPU"] = $cpu.Name
$results["CPU Present"] = $true
# RAM Check
$ram = [math]::Round((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
$results["RAM (GB)"] = $ram
$results["RAM >= 4GB"] = $ram -ge 4
# TPM Check
try {
$tpm = Get-WmiObject -Namespace "Root\CIMv2\Security\MicrosoftTpm" -Class Win32_Tpm -ErrorAction Stop
$results["TPM Present"] = $tpm.TpmPresent
$results["TPM Ready (2.0)"] = $tpm.SpecVersion -match "2\.0"
} catch {
$results["TPM Present"] = $false
$results["TPM Ready (2.0)"] = $false
}
# Partition Style
try {
$disk = Get-Disk | Where-Object { $_.IsSystem -eq $true }
$results["Partition Style"] = $disk.PartitionStyle
$results["Disk is GPT"] = $disk.PartitionStyle -eq 'GPT'
} catch {
$results["Disk is GPT"] = $false
}
# Boot Mode
try {
$firmware = Get-WmiObject -Class Win32_ComputerSystem
$bootMode = $firmware.BootupState
$results["Boot Mode"] = $bootMode
$results["UEFI Boot"] = $bootMode -like "*UEFI*"
} catch {
$results["UEFI Boot"] = $false
}
# Secure Boot
try {
$sb = Confirm-SecureBootUEFI -ErrorAction Stop
$results["Secure Boot Enabled"] = $sb
} catch {
$results["Secure Boot Enabled"] = $false
}
# Final Verdict
$eligible = $true
foreach ($check in @("CPU Present", "RAM >= 4GB", "TPM Present", "TPM Ready (2.0)", "Disk is GPT", "UEFI Boot")) {
if ($results[$check] -ne $true) {
$eligible = $false
}
}
# Display Results
Write-Host "Windows 11 Readiness Check for: $env:COMPUTERNAME" -ForegroundColor Cyan
$results.GetEnumerator() | Sort-Object Name | ForEach-Object {
$label = "{0,-25}:" -f $_.Key
Write-Host "$label $_.Value"
}
Write-Host "`nFinal Result: " -NoNewline
if ($eligible) {
Write-Host "YES – This machine is eligible for Windows 11." -ForegroundColor Green
} else {
Write-Host "NO – This machine is NOT eligible for Windows 11." -ForegroundColor Red
}
}