mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-24 17:31:05 +02:00
Update check-pending-reboot.ps1
This commit is contained in:
parent
7e777f07ee
commit
1e3265b02b
@ -22,6 +22,11 @@ function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNull
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$Reason = ""
|
$Reason = ""
|
||||||
|
if ($IsLinux) {
|
||||||
|
if (Test-Path "/var/run/reboot-required") {
|
||||||
|
$Reason = "found /var/run/reboot-required"
|
||||||
|
}
|
||||||
|
} 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") {
|
||||||
$Reason += ", found registry entry '...\WindowsUpdate\Auto Update\RebootRequired'"
|
$Reason += ", found registry entry '...\WindowsUpdate\Auto Update\RebootRequired'"
|
||||||
}
|
}
|
||||||
@ -55,6 +60,7 @@ try {
|
|||||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
|
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
|
||||||
$Reason += ", found registry entry '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
$Reason += ", found registry entry '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($Reason -ne "") {
|
if ($Reason -ne "") {
|
||||||
Write-Host "⚠️ Pending reboot ($($Reason.substring(2)))"
|
Write-Host "⚠️ Pending reboot ($($Reason.substring(2)))"
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user