File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Sources/Winget-AutoUpdate Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -409,11 +409,12 @@ if (Test-Network) {
409409 }
410410
411411 $shutdownMessage = if ($ModsResult.Message ) { $ModsResult.Message } else { " WAU Mods requested a system reboot in $rebootDelay minutes" }
412+ $rebootHandler = if ($ModsResult.RebootHandler ) { $ModsResult.RebootHandler } else { " Windows" }
412413
413414 # Check if SCCM client is available for managed restart (user controlled)
414415 $sccmClient = Get-CimInstance - Namespace " root\ccm" - ClassName " SMS_Client" - ErrorAction SilentlyContinue
415416
416- if ($sccmClient ) {
417+ if ($sccmClient -and ( $rebootHandler -eq " SCCM " ) ) {
417418 Write-ToLog " SCCM client detected - using managed restart (user controlled)" " Green"
418419
419420 try {
@@ -498,7 +499,7 @@ if (Test-Network) {
498499 }
499500 }
500501 } else {
501- # Standard shutdown when SCCM is not available
502+ # Standard shutdown when SCCM is not available (or "Windows" expplicitly requested as reboot handler)
502503 $result = & shutdown / r / t ([int ]($rebootDelay * 60 )) / c $shutdownMessage 2>&1
503504 if ($LASTEXITCODE -eq 0 ) {
504505 Write-ToLog " System restart scheduled in $rebootDelay minutes" " Yellow"
Original file line number Diff line number Diff line change 2121 "LogLevel": "string", // Optional: Log level for the message
2222 "ExitCode": number, // Optional: Windows installer exit code for reference
2323 "PostponeDuration": number, // Optional: Postpone duration in hours before running WAU again (default 1 hour)
24- "RebootDelay": number // Optional: Delay in minutes before rebooting (default 5 minutes)
24+ "RebootDelay": number, // Optional: Delay in minutes before rebooting (default 5 minutes)
25+ "RebootHandler": string // Optional: "SCCM" or "Windows" (default "Windows") to specify reboot handler
2526 }
2627
2728 Available Actions:
7576 # Example 4: Request reboot after checks
7677 $result = @{
7778 Action = "Reboot"
78- Message = "The system needs to reboot within 5 minutes before WAU updates can be performed."
79+ Message = "The system needs to reboot within 15 minutes before WAU updates can be performed."
7980 LogLevel = "Red"
8081 ExitCode = 3010
81- RebootDelay = 10 # Optional: Delay before rebooting (default is 5 minutes)
82+ RebootDelay = 15 # Optional: Delay before rebooting (default is 5 minutes)
83+ RebootHandler = "SCCM" # Optional: Specify reboot handler (default is "Windows")
8284 } | ConvertTo-Json -Compress
8385
8486. NOTES
You can’t perform that action at this time.
0 commit comments