Remote
parent
066ee51dca
commit
1cff1a9919
|
|
@ -1,43 +1,51 @@
|
|||
$remoteComputer = "REMOTE-PC-NAME"
|
||||
|
||||
Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
|
||||
$results = @{}
|
||||
$results = [ordered]@{}
|
||||
|
||||
# CPU Check (existence assumed OK for this test)
|
||||
# CPU Check
|
||||
$cpu = Get-WmiObject Win32_Processor
|
||||
$cpuName = $cpu | Select-Object -ExpandProperty Name
|
||||
$results["CPU"] = $cpuName
|
||||
$results["CPU Present"] = $true
|
||||
|
||||
# RAM Check
|
||||
$ram = [math]::Round((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
|
||||
$results["RAM >= 4GB"] = $ram -ge 4
|
||||
$ramBytes = (Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory
|
||||
$ramGB = [math]::Round($ramBytes / 1GB, 2)
|
||||
$results["RAM (GB)"] = $ramGB
|
||||
$results["RAM >= 4GB"] = $ramGB -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"
|
||||
$results["TPM Ready (2.0)"] = $tpm.SpecVersion -match "2\.0"
|
||||
} catch {
|
||||
$results["TPM Present"] = $false
|
||||
$results["TPM Ready"] = $false
|
||||
$results["TPM Ready (2.0)"] = $false
|
||||
}
|
||||
|
||||
# Partition Style
|
||||
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["Disk is GPT"] = $disk.PartitionStyle -eq 'GPT'
|
||||
} catch {
|
||||
$results["Partition Style"] = "Unknown"
|
||||
$results["Disk is GPT"] = $false
|
||||
}
|
||||
|
||||
# Boot Mode
|
||||
try {
|
||||
$firmware = Get-WmiObject -Class Win32_ComputerSystem
|
||||
$results["UEFI Boot"] = $firmware.BootupState -like "*UEFI*"
|
||||
$bootMode = $firmware.BootupState
|
||||
$results["Boot Mode"] = $bootMode
|
||||
$results["UEFI Boot"] = $bootMode -like "*UEFI*"
|
||||
} catch {
|
||||
$results["UEFI Boot"] = $false
|
||||
}
|
||||
|
||||
# Secure Boot (Optional)
|
||||
# Secure Boot
|
||||
try {
|
||||
$sb = Confirm-SecureBootUEFI -ErrorAction Stop
|
||||
$results["Secure Boot Enabled"] = $sb
|
||||
|
|
@ -46,22 +54,24 @@ Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
|
|||
}
|
||||
|
||||
# Final Verdict
|
||||
$eligibilityChecks = @("CPU Present", "RAM >= 4GB", "TPM Present", "TPM Ready (2.0)", "Disk is GPT", "UEFI Boot")
|
||||
$eligible = $true
|
||||
foreach ($check in $results.Keys) {
|
||||
if ($results[$check] -ne $true) {
|
||||
foreach ($key in $eligibilityChecks) {
|
||||
if (-not $results[$key]) {
|
||||
$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
|
||||
# Output results cleanly
|
||||
Write-Host "`nWindows 11 Readiness Check for: $env:COMPUTERNAME" -ForegroundColor Cyan
|
||||
foreach ($key in $results.Keys) {
|
||||
Write-Host ("{0,-25}: {1}" -f $key, $results[$key])
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
$remoteComputer = "REMOTE-PC-NAME"
|
||||
|
||||
Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
|
||||
$results = [ordered]@{}
|
||||
|
||||
# CPU Check
|
||||
$cpu = Get-WmiObject Win32_Processor
|
||||
$cpuName = $cpu | Select-Object -ExpandProperty Name
|
||||
$results["CPU"] = $cpuName
|
||||
$results["CPU Present"] = $true
|
||||
|
||||
# RAM Check
|
||||
$ramBytes = (Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory
|
||||
$ramGB = [math]::Round($ramBytes / 1GB, 2)
|
||||
$results["RAM (GB)"] = $ramGB
|
||||
$results["RAM >= 4GB"] = $ramGB -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 } | Select-Object -First 1
|
||||
$results["Partition Style"] = $disk.PartitionStyle
|
||||
$results["Disk is GPT"] = $disk.PartitionStyle -eq 'GPT'
|
||||
} catch {
|
||||
$results["Partition Style"] = "Unknown"
|
||||
$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
|
||||
$eligibilityChecks = @("CPU Present", "RAM >= 4GB", "TPM Present", "TPM Ready (2.0)", "Disk is GPT", "UEFI Boot")
|
||||
$eligible = $true
|
||||
foreach ($key in $eligibilityChecks) {
|
||||
if (-not $results[$key]) {
|
||||
$eligible = $false
|
||||
}
|
||||
}
|
||||
|
||||
# Output results cleanly
|
||||
Write-Host "`nWindows 11 Readiness Check for: $env:COMPUTERNAME" -ForegroundColor Cyan
|
||||
foreach ($key in $results.Keys) {
|
||||
Write-Host ("{0,-25}: {1}" -f $key, $results[$key])
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue