Cómo verificar el reinicio pendiente en una computadora con Windows

Como Verificar El Reinicio Pendiente En Una Computadora Con Windows



Por lo general, después de que un usuario instala un controlador, una actualización (software o sistema) o software, o realiza algunos cambios de configuración en una máquina cliente o servidor de Windows, se le solicitará al usuario que reinicie el sistema. En esta publicación, lo guiaremos a través de los pasos sobre cómo verifique el reinicio pendiente en una computadora con Windows .



  Cómo verificar el reinicio pendiente en una computadora con Windows





Cómo verificar el reinicio pendiente en una computadora con Windows

Al completar muchas tareas del sistema operativo Windows, a veces la computadora se ve obligada a reiniciar. Mientras esté conectado y en una sesión activa, se le notificará que hay un reinicio pendiente o requerido por algún cuadro emergente o notificación, que puede descartar o aceptar para reiniciar Windows. Sin embargo, en algunas situaciones en las que no desea o no puede reiniciar inmediatamente la máquina; por ejemplo, tiene algún trabajo pendiente que debe completar antes de reiniciar, o acaba de instalar actualizaciones en un servidor de producción y ese servidor puede no se reiniciará de inmediato.





En escenarios como este, especialmente en lo que respecta a este último, es posible que se olvide del reinicio y más tarde se dé cuenta de que algunos servidores o máquinas cliente deben reiniciarse, pero ahora no puede identificar cuál de las máquinas: en esta situación, puede verificar el reinicio pendiente en una computadora con Windows usando un Potencia Shell guion.



herramienta de eliminación de junkware

Ahora, cuando esté pendiente un reinicio, Windows agregará algunos valores de registro o indicadores para indicarlo en la siguiente ubicación de registro con los valores y condiciones asociados, como se muestra en la siguiente tabla.

Llave Valor Condición
HKLM:\SOFTWARE\Microsoft\Actualizaciones ActualizarExeVolátil El valor es cualquier cosa distinta de 0
HKLM:\SISTEMA\CurrentControlSet\Control\Session Manager PendingFileRenameOperations el valor existe
HKLM:\SISTEMA\CurrentControlSet\Control\Session Manager PendingFileRenameOperations2 el valor existe
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired ESO la clave existe
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\Pending ESO Cualquier subclave GUID existe
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting ESO la clave existe
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce Señal de reinicio de DVD el valor existe
HKLM:\Software\Microsoft\Windows\CurrentVersion\Servicio basado en componentes\RebootPending ESO la clave existe
HKLM:\Software\Microsoft\Windows\CurrentVersion\Servicio basado en componentes\RebootInProgress ESO la clave existe
HKLM:\Software\Microsoft\Windows\CurrentVersion\Servicio basado en componentes\Paquetes pendientes ESO la clave existe
HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts ESO la clave existe
HKLM:\SISTEMA\CurrentControlSet\Servicios\Netlogon Unirse a Dominio el valor existe
HKLM:\SISTEMA\CurrentControlSet\Servicios\Netlogon EvitarSpnSet el valor existe
HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName Nombre de la computadora Valor ComputerName en HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName es diferente

Como hemos identificado las rutas de registro relevantes, en lugar de revisar manualmente el registro porque puede olvidarse de verificar una ruta de registro o simplemente olvidar cuáles verificar, puede crear y ejecutar un script Check-PendingReboot.ps1 usando el código a continuación para automatizar la tarea de verificar todas las claves de registro en la tabla anterior.

  Crear y ejecutar un script de PowerShell



[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]]$ComputerName,
[Parameter()]
[ValidateNotNullOrEmpty()]
[pscredential]$Credential
)
$ErrorActionPreference = 'Stop'
$scriptBlock = {
$VerbosePreference = $using:VerbosePreference
function Test-RegistryKey {
[OutputType('bool')]
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Key
)
$ErrorActionPreference = 'Stop'
if (Get-Item -Path $Key -ErrorAction Ignore) {
$true
}
}
function Test-RegistryValue {
[OutputType('bool')]
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Key,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Value
)
$ErrorActionPreference = 'Stop'
if (Get-ItemProperty -Path $Key -Name $Value -ErrorAction Ignore) {
$true
}
}
function Test-RegistryValueNotNull {
[OutputType('bool')]
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Key,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Value
)
$ErrorActionPreference = 'Stop'
if (($regVal = Get-ItemProperty -Path $Key -Name $Value -ErrorAction Ignore) -and $regVal.($Value)) {
$true
}
}
# Added "test-path" to each test that did not leverage a custom function from above since
# an exception is thrown when Get-ItemProperty or Get-ChildItem are passed a nonexistant key path
$tests = @(
{ Test-RegistryKey -Key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending' }
{ Test-RegistryKey -Key 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootInProgress' }
{ Test-RegistryKey -Key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' }
{ Test-RegistryKey -Key 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackagesPending' }
{ Test-RegistryKey -Key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting' }
{ Test-RegistryValueNotNull -Key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Value 'PendingFileRenameOperations' }
{ Test-RegistryValueNotNull -Key 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Value 'PendingFileRenameOperations2' }
{ 
# Added test to check first if key exists, using "ErrorAction ignore" will incorrectly return $true
'HKLM:\SOFTWARE\Microsoft\Updates' | Where-Object { test-path $_ -PathType Container } | ForEach-Object { 
(Get-ItemProperty -Path $_ -Name 'UpdateExeVolatile' | Select-Object -ExpandProperty UpdateExeVolatile) -ne 0 
}
}
{ Test-RegistryValue -Key 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce' -Value 'DVDRebootSignal' }
{ Test-RegistryKey -Key 'HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttemps' }
{ Test-RegistryValue -Key 'HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon' -Value 'JoinDomain' }
{ Test-RegistryValue -Key 'HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon' -Value 'AvoidSpnSet' }
{
# Added test to check first if keys exists, if not each group will return $Null
# May need to evaluate what it means if one or both of these keys do not exist
( 'HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName' | Where-Object { test-path $_ } | %{ (Get-ItemProperty -Path $_ ).ComputerName } ) -ne 
( 'HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName' | Where-Object { Test-Path $_ } | %{ (Get-ItemProperty -Path $_ ).ComputerName } )
}
{
# Added test to check first if key exists
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\Pending' | Where-Object { 
(Test-Path $_) -and (Get-ChildItem -Path $_) } | ForEach-Object { $true }
}
)
foreach ($test in $tests) {
Write-Verbose "Running scriptblock: [$($test.ToString())]"
if (& $test) {
$true
break
}
}
}
foreach ($computer in $ComputerName) {
try {
$connParams = @{
'ComputerName' = $computer
}
if ($PSBoundParameters.ContainsKey('Credential')) {
$connParams.Credential = $Credential
}
$output = @{
ComputerName = $computer
IsPendingReboot = $false
}
$psRemotingSession = New-PSSession @connParams
if (-not ($output.IsPendingReboot = Invoke-Command -Session $psRemotingSession -ScriptBlock $scriptBlock)) {
$output.IsPendingReboot = $false
}
[pscustomobject]$output
} catch {
Write-Error -Message $_.Exception.Message
} finally {
if (Get-Variable -Name 'psRemotingSession' -ErrorAction Ignore) {
$psRemotingSession | Remove-PSSession
}
}
}

Puede proporcionar tantos servidores como desee a través de la Nombre de la computadora parámetro en el script que devolverá Verdadero o FALSO junto con el nombre del servidor. Puede ejecutar el script similar al siguiente y asegurarse Comunicación remota de PowerShell está configurado y disponible en sus servidores.

PS51> .\Test-PendingReboot.ps1 -Server SRV1,SRV2,SRV3,etc

Leer : Cómo programar el script de PowerShell en el Programador de tareas

Al usar el script de PowerShell, puede consultar una o todas las computadoras en el dominio o proporcionar manualmente los nombres de los servidores para determinar las máquinas pendientes de reiniciar. Una vez identificado, puede reiniciar las máquinas de inmediato o hacer una lista para reiniciar más tarde.

Ahora lee : Cómo reiniciar remotamente una computadora con Windows usando PowerShell

¿Es seguro iobit malware fighter?

¿Qué significa que hay un reinicio de Windows pendiente?

Generalmente, una solicitud de reinicio pendiente ocurre cuando un programa o instalación realiza un cambio en los archivos, las claves de registro, los servicios o la configuración del sistema operativo, lo que puede dejar el sistema en un estado transitorio. En el caso de que obtenga el Se ha detectado un reinicio pendiente notificación, simplemente indica que hay actualizaciones pendientes en la máquina y se debe reiniciar antes de que se puedan instalar actualizaciones adicionales.

Leer :

  • Cómo deshabilitar o habilitar la notificación de reinicio de actualización
  • Actualización de Windows pendiente de instalación o descarga, inicializando, etc.

¿Cómo verificar reinicios pendientes en el registro?

Puedes hacer esto por buscando en el Registro de Windows Para el Reinicio requerido llave. En la tabla anterior de esta publicación, hemos identificado la ubicación de registro relevante para las claves de registro de reinicio pendientes. Si desea mostrar una notificación cuando su PC requiera un reinicio para completar la instalación de una actualización de Windows, haga clic en Comenzar > Ajustes > Actualización y seguridad > Actualizaciones de Windows > Opciones avanzadas . Active o desactive el botón para el Mostrar una notificación cuando su PC requiera un reinicio para finalizar la actualización opción.

también lea : Hay una reparación del sistema pendiente que requiere reiniciar para completarse .

Entradas Populares