mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-10 21:33:47 +02:00
Update some check-*.ps1 scripts
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Check for pending reboots
|
||||
.DESCRIPTION
|
||||
@ -23,41 +23,41 @@ function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNull
|
||||
$Reason = ""
|
||||
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
|
||||
$Reason +="found registry key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'."
|
||||
$Reason += "found registry key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' "
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting") {
|
||||
$Reason += "found registry key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting'."
|
||||
$Reason += "found registry key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting' "
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") {
|
||||
$Reason += "found registry key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending'."
|
||||
$Reason += "found registry key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending' "
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts") {
|
||||
$Reason += "found registry key 'HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts'."
|
||||
$Reason += "found registry key 'HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts' "
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "RebootInProgress") {
|
||||
$Reason += "registry key 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing' contains 'RebootInProgress'."
|
||||
$Reason += "registry 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing' = 'RebootInProgress' "
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "PackagesPending") {
|
||||
$Reason += "registry key 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing' contains 'PackagesPending'."
|
||||
$Reason += "registry 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing' = 'PackagesPending' "
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Value "PendingFileRenameOperations") {
|
||||
$Reason += "registry key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' contains 'PendingFileRenameOperations'."
|
||||
$Reason += "registry 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' = 'PendingFileRenameOperations' "
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Value "PendingFileRenameOperations2") {
|
||||
$Reason += "registry key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' contains 'PendingFileRenameOperations2'."
|
||||
$Reason += "registry 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' = 'PendingFileRenameOperations2' "
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" -Value "DVDRebootSignal") {
|
||||
$Reason += "registry key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce' contains 'DVDRebootSignal'."
|
||||
$Reason += "registry 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce' = 'DVDRebootSignal' "
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "JoinDomain") {
|
||||
$Reason += "registry key 'HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon' contains 'JoinDomain'."
|
||||
$Reason += "registry 'HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon' = 'JoinDomain' "
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
|
||||
$Reason += "registry key 'HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon' contains 'AvoidSpnSet'."
|
||||
$Reason += "registry 'HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon' = 'AvoidSpnSet' "
|
||||
}
|
||||
if ($Reason -eq "") {
|
||||
"✅ No pending reboot."
|
||||
} else {
|
||||
"⚠️pending reboot ($Reason)."
|
||||
"⚠️ Pending reboot ($Reason)."
|
||||
}
|
||||
exit 0 # success
|
Reference in New Issue
Block a user