Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix input schema validation for RebootPending resource #488

Merged
merged 11 commits into from
Sep 26, 2024
Prev Previous commit
Next Next commit
updated pproperty to camelCasing
anmenaga committed Jul 16, 2024
commit 0777706147bf2088a9ce37f38b0c40086118833e
4 changes: 2 additions & 2 deletions reboot_pending/reboot_pending.dsc.resource.json
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@
"schema": {
"embedded": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "null",
"type": "[object, null]",
"properties": {
"RebootPending": {
"rebootPending": {
"type": "boolean"
}
}
10 changes: 5 additions & 5 deletions reboot_pending/reboot_pending.resource.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Reg keys are documented here: https://learn.microsoft.com/en-us/mem/configmgr/core/servers/deploy/install/list-of-prerequisite-checks#pending-system-restart
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return @{ RebootPending = $true } | ConvertTo-Json -Compress }
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return @{ RebootPending = $true } | ConvertTo-Json -Compress }
if (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -EA Ignore) { return @{ RebootPending = $true } | ConvertTo-Json -Compress }
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return @{ rebootPending = $true } | ConvertTo-Json -Compress }
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return @{ rebootPending = $true } | ConvertTo-Json -Compress }
if (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -EA Ignore) { return @{ rebootPending = $true } | ConvertTo-Json -Compress }
try {
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities"
$status = $util.DetermineIfRebootPending()
if(($status -ne $null) -and $status.RebootPending){
return @{ RebootPending = $true } | ConvertTo-Json -Compress
return @{ rebootPending = $true } | ConvertTo-Json -Compress
}
}catch{}

return @{ RebootPending = $false } | ConvertTo-Json -Compress
return @{ rebootPending = $false } | ConvertTo-Json -Compress