Skip to content

Commit 2f19a05

Browse files
committed
Resolve remarks
1 parent 767cd5e commit 2f19a05

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
14
# Reg keys are documented here: https://learn.microsoft.com/en-us/mem/configmgr/core/servers/deploy/install/list-of-prerequisite-checks#pending-system-restart
2-
$reasons = @()
5+
$reasons = [System.Collections.Generic.List[string[]]]::new()
36
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) {
4-
$reasons += "Component Based Servicing"
7+
$reasons.Add("Component Based Servicing")
58
}
69
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) {
7-
$reasons += "Windows Update"
10+
$reasons.Add("Windows Update")
811
}
912
if (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -EA Ignore) {
10-
$reasons += "Pending File Rename Operations"
13+
$reasons.Add("Pending File Rename Operations")
1114
}
1215
try {
1316
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities"
1417
$status = $util.DetermineIfRebootPending()
1518
if(($null -ne $status) -and $status.RebootPending){
16-
$reasons += "SCCM Client"
19+
$reasons.Add("SCCM Client")
1720
}
1821
}catch{}
1922

2023
$result = @{
2124
rebootPending = $reasons.Count -gt 0
2225
reason = if ($reasons.Count -gt 0) { $reasons } else { $null }
2326
}
27+
2428
return $result | ConvertTo-Json -Compress

0 commit comments

Comments
 (0)