WindowsUpgradeChecker/upgradechecker_remote.ps1

68 lines
1.9 KiB
PowerShell

$remoteComputer = "REMOTE-PC-NAME"
Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
$results = @{}
# CPU Check (existence assumed OK for this test)
$cpu = Get-WmiObject Win32_Processor
$results["CPU Present"] = $true
# RAM Check
$ram = [math]::Round((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
$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"] = $tpm.SpecVersion -match "2\.0"
} catch {
$results["TPM Present"] = $false
$results["TPM Ready"] = $false
}
# Partition Style
try {
$disk = Get-Disk | Where-Object { $_.IsSystem -eq $true }
$results["Disk is GPT"] = $disk.PartitionStyle -eq 'GPT'
} catch {
$results["Disk is GPT"] = $false
}
# Boot Mode
try {
$firmware = Get-WmiObject -Class Win32_ComputerSystem
$results["UEFI Boot"] = $firmware.BootupState -like "*UEFI*"
} catch {
$results["UEFI Boot"] = $false
}
# Secure Boot (Optional)
try {
$sb = Confirm-SecureBootUEFI -ErrorAction Stop
$results["Secure Boot Enabled"] = $sb
} catch {
$results["Secure Boot Enabled"] = $false
}
# Final Verdict
$eligible = $true
foreach ($check in $results.Keys) {
if ($results[$check] -ne $true) {
$eligible = $false
}
}
# Output Summary
[PSCustomObject]@{
ComputerName = $env:COMPUTERNAME
CPU = $cpu.Name
RAM_GB = $ram
TPM_Ready = $results["TPM Ready"]
UEFI = $results["UEFI Boot"]
GPT = $results["Disk is GPT"]
SecureBoot = $results["Secure Boot Enabled"]
Eligible = $eligible
}
}