mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-22 09:58:19 +02:00
Update check-pending-reboot.ps1
This commit is contained in:
parent
e15be92a54
commit
fde2fff232
@ -25,6 +25,7 @@ try {
|
|||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
if (Test-Path "/var/run/reboot-required") {
|
if (Test-Path "/var/run/reboot-required") {
|
||||||
$Reason = "found /var/run/reboot-required"
|
$Reason = "found /var/run/reboot-required"
|
||||||
|
Write-Host "⚠️ Pending reboot ($Reason)"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
|
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
|
||||||
@ -57,10 +58,11 @@ try {
|
|||||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
|
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
|
||||||
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ($Reason -ne "") {
|
if ($Reason -ne "") {
|
||||||
Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))"
|
Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))"
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
if ($Reason -eq "") {
|
||||||
Write-Host "✅ No pending reboot"
|
Write-Host "✅ No pending reboot"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user