Windowsコンピューターで保留中の再起動を確認する方法

Windowskonpyutade Bao Liu Zhongno Zai Qi Dongwo Que Rensuru Fang Fa



通常、ユーザーがドライバー、更新 (ソフトウェアまたはシステム)、またはソフトウェアをインストールした後、または Windows クライアントまたはサーバー コンピューターで構成を変更した後、ユーザーはシステムを再起動するように求められます。この投稿では、次の手順について説明します。 Windows コンピューターで保留中の再起動を確認する .



  Windowsコンピューターで保留中の再起動を確認する方法





Windows コンピューターで保留中の再起動を確認する方法

多くの Windows OS タスクが完了すると、コンピュータの再起動が強制される場合があります。ログインし、アクティブなセッションにいる間、ポップアップ ボックスまたは通知によって、再起動が保留中または必要であることが通知されます。これを無視するか、Windows を再起動するために受け入れることができます。ただし、マシンをすぐに再起動したくない、またはすぐに再起動できない場合があります。すぐに再起動しないでください。





このようなシナリオでは、特に後者に関しては、再起動のことを忘れて、後で一部のサーバーまたはクライアント マシンを再起動する必要があることに気付くかもしれませんが、どのマシンかを特定できません。この状況では、を使用して、Windows コンピューターで保留中の再起動を確認できます。 パワーシェル 脚本。



現在、再起動が保留中の場合、Windows は、次の表に示すように、関連付けられた値と条件を使用して、次のレジストリの場所にそのことを示すレジストリ値またはフラグを追加します。

価値 状態
HKLM:\SOFTWARE\Microsoft\Updates UpdateExeVolatile 値は 0 以外です
HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager 保留中のファイルの名前変更操作 値が存在する
HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager PendingFileRenameOperations2 値が存在する
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired それか キーが存在する
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\Pending それか GUID サブキーが存在する
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting それか キーが存在する
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce DVD再起動信号 値が存在する
HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending それか キーが存在する
HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootInProgress それか キーが存在する
HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackagesPending それか キーが存在する
HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts それか キーが存在する
HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon 参加ドメイン 値が存在する
HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon 回避SpnSet 値が存在する
HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName コンピュータネーム HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName の値 ComputerName が異なります

関連するレジストリ パスを特定したので、1 つのレジストリ パスを確認するのを忘れたり、どれを確認するかを忘れたりする可能性があるため、手動でレジストリをくまなく調べる必要はありません。 作成して実行する 以下のコードを使用して Check-PendingReboot.ps1 スクリプトを作成し、上記の表のすべてのレジストリ キーをチェックするタスクを自動化します。

  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
}
F162D54158043DB8E9DF57188​​FC4C51A65610038

を介して、必要な数のサーバーを提供できます。 コンピュータネーム 返すスクリプトのパラメータ 真実 また 間違い サーバー名とともに。次のようなスクリプトを実行して、 PowerShell リモート処理 サーバー上でセットアップされ、利用可能です。

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

読む : タスク スケジューラで PowerShell スクリプトをスケジュールする方法

PowerShell スクリプトを使用すると、ドメイン内の 1 つまたはすべてのコンピューターにクエリを実行したり、サーバー名を手動で指定して、再起動が保留されているコンピューターを特定したりできます。特定したら、すぐにマシンを再起動するか、後で再起動するリストを作成できます。

今すぐ読む : PowerShell を使用して Windows コンピューターをリモートで再起動する方法

Windows の再起動が保留中とはどういう意味ですか?

通常、保留中の再起動要求は、プログラムまたはインストールによってファイル、レジストリ キー、サービス、またはオペレーティング システムの設定が変更され、システムが一時的な状態になる可能性がある場合に発生します。あなたが得る場合には 保留中の再起動が検出されました 通知は、更新がマシンで保留中であり、追加の更新をインストールする前に再起動を実行する必要があることを示しているだけです。

読む :

Windows用のチャットクライアント
  • 更新の再起動通知を無効または有効にする方法
  • Windows Update 保留中のインストールまたはダウンロード、初期化中など

レジストリで保留中の再起動を確認する方法は?

あなたはこれを行うことができます Windows レジストリの検索 のために 再起動必須 鍵。この記事の上の表では、保留中の再起動レジストリ キーに関連するレジストリの場所を特定しました。 Windows Update のインストールを完了するために PC の再起動が必要な場合に通知を表示するには、 始める > 設定 > 更新とセキュリティ > Windows アップデート > 高度なオプション .ボタンをオンまたはオフに切り替えます。 更新を完了するために PC の再起動が必要な場合に通知を表示する オプション。

また読む : 完了するには再起動が必要なシステム修復が保留中です .

人気の投稿