File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
1
4
# 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 ()
3
6
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" )
5
8
}
6
9
if (Get-Item " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" - EA Ignore) {
7
- $reasons += " Windows Update"
10
+ $reasons.Add ( " Windows Update" )
8
11
}
9
12
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" )
11
14
}
12
15
try {
13
16
$util = [wmiclass ]" \\.\root\ccm\clientsdk:CCM_ClientUtilities"
14
17
$status = $util.DetermineIfRebootPending ()
15
18
if (($null -ne $status ) -and $status.RebootPending ){
16
- $reasons += " SCCM Client"
19
+ $reasons.Add ( " SCCM Client" )
17
20
}
18
21
}catch {}
19
22
20
23
$result = @ {
21
24
rebootPending = $reasons.Count -gt 0
22
25
reason = if ($reasons.Count -gt 0 ) { $reasons } else { $null }
23
26
}
27
+
24
28
return $result | ConvertTo-Json - Compress
You can’t perform that action at this time.
0 commit comments