diff --git a/8x8_Work_Updater.ps1 b/8x8_Work_Updater.ps1 index 7dfe4d6..6ece69b 100644 --- a/8x8_Work_Updater.ps1 +++ b/8x8_Work_Updater.ps1 @@ -1,8 +1,8 @@ # ============================================================================== # Script Name: 8x8_Work_Updater.ps1 -# Description: Downloads 8x8 with a progress bar, pops up an interactive -# unclosable countdown window (1-hour timer with "Update Now"), -# silently installs 8x8, and launches the updated client. +# Description: Downloads 8x8 with a progress bar, triggers a native service +# notification modal dialog on the user screen (bypasses non-interactive +# Session 0 blocks), silently installs, and relaunches 8x8. # ============================================================================== # Ensure script is running elevated @@ -11,9 +11,8 @@ if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti exit 1 } -# Load required .NET assemblies +# Load required assemblies Add-Type -AssemblyName System.Windows.Forms -Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Net.Http $workDir = "C:\ProgramData\JCT600_8x8Update" @@ -64,90 +63,22 @@ try { } # -------------------------------------------------------------------------- - # Step 2: Show Interactive JCT600 Dialog Form + # Step 2: Show ServiceNotification Dialog (Crosses Session 0 Isolation) # -------------------------------------------------------------------------- - Write-Host "[2/4] Displaying interactive countdown dialog..." -ForegroundColor Cyan + Write-Host "[2/4] Displaying interactive notification on user desktop..." -ForegroundColor Cyan - [System.Windows.Forms.Application]::EnableVisualStyles() + $title = "JCT600 IT Support — 8x8 Work Update" + $message = "An automatic update for 8x8 Work has been scheduled by IT Support.`n`nPlease save active work and wrap up ongoing calls.`n`nClick OK to proceed with the update." - $form = New-Object System.Windows.Forms.Form - $form.Text = "JCT600 IT Support — 8x8 Work Update" - $form.Size = New-Object System.Drawing.Size(460, 260) - $form.StartPosition = 'CenterScreen' - $form.FormBorderStyle = 'FixedDialog' - $form.MaximizeBox = $false - $form.MinimizeBox = $false - $form.ControlBox = $false - $form.TopMost = $true - - $script:allowClose = $false - $form.Add_FormClosing({ - param($sender, $e) - if (-not $script:allowClose) { $e.Cancel = $true } - }) - - $labelHeader = New-Object System.Windows.Forms.Label - $labelHeader.Text = "JCT600 — IT SUPPORT" - $labelHeader.Location = New-Object System.Drawing.Point(20, 15) - $labelHeader.Size = New-Object System.Drawing.Size(400, 25) - $labelHeader.Font = New-Object System.Drawing.Font("Segoe UI", 12, [System.Drawing.FontStyle]::Bold) - $labelHeader.ForeColor = [System.Drawing.Color]::Navy - $labelHeader.TextAlign = 'TopCenter' - $form.Controls.Add($labelHeader) - - $labelMsg = New-Object System.Windows.Forms.Label - $labelMsg.Text = "An automatic update for 8x8 Work has been scheduled by IT Support.`nPlease save active work or click 'Update Now' to proceed." - $labelMsg.Location = New-Object System.Drawing.Point(20, 48) - $labelMsg.Size = New-Object System.Drawing.Size(400, 40) - $labelMsg.Font = New-Object System.Drawing.Font("Segoe UI", 9) - $labelMsg.TextAlign = 'TopCenter' - $form.Controls.Add($labelMsg) - - $labelTimer = New-Object System.Windows.Forms.Label - $labelTimer.Location = New-Object System.Drawing.Point(20, 95) - $labelTimer.Size = New-Object System.Drawing.Size(400, 40) - $labelTimer.Font = New-Object System.Drawing.Font("Segoe UI", 20, [System.Drawing.FontStyle]::Bold) - $labelTimer.ForeColor = [System.Drawing.Color]::DarkRed - $labelTimer.TextAlign = 'MiddleCenter' - $form.Controls.Add($labelTimer) - - $btnUpdateNow = New-Object System.Windows.Forms.Button - $btnUpdateNow.Text = "Update Now" - $btnUpdateNow.Font = New-Object System.Drawing.Font("Segoe UI", 10, [System.Drawing.FontStyle]::Bold) - $btnUpdateNow.Size = New-Object System.Drawing.Size(150, 40) - $btnUpdateNow.Location = New-Object System.Drawing.Point(145, 155) - $btnUpdateNow.UseVisualStyleBackColor = $true - - $timer = New-Object System.Windows.Forms.Timer - $timer.Interval = 1000 - $script:remaining = 3600 # 1 Hour - - $btnUpdateNow.Add_Click({ - $timer.Stop() - $script:allowClose = $true - $form.Close() - }) - $form.Controls.Add($btnUpdateNow) - - $timer.Add_Tick({ - if ($script:remaining -gt 0) { - $timeSpan = [TimeSpan]::FromSeconds($script:remaining) - $labelTimer.Text = $timeSpan.ToString("hh\:mm\:ss") - $script:remaining-- - } else { - $timer.Stop() - $script:allowClose = $true - $form.Close() - } - }) - - $initialSpan = [TimeSpan]::FromSeconds($script:remaining) - $labelTimer.Text = $initialSpan.ToString("hh\:mm\:ss") - - $timer.Start() - $form.ShowDialog() | Out-Null - $timer.Dispose() - $form.Dispose() + # Use ServiceNotification flag to display onto the interactive desktop + [System.Windows.Forms.MessageBox]::Show( + $message, + $title, + [System.Windows.Forms.MessageBoxButtons]::OK, + [System.Windows.Forms.MessageBoxIcon]::Information, + [System.Windows.Forms.MessageBoxDefaultButton]::Button1, + [System.Windows.Forms.MessageBoxOptions]::ServiceNotification + ) | Out-Null # -------------------------------------------------------------------------- # Step 3: Close Running 8x8 Processes & Install Silently @@ -190,7 +121,7 @@ try { $exePath = $possiblePaths | Where-Object { Test-Path $_ } | Select-Object -First 1 if ($exePath) { - # Launching via explorer.exe ensures standard user execution token + # Using explorer.exe to launch the executable forces standard user graphics execution Start-Process "explorer.exe" -ArgumentList "`"$exePath`"" Write-Host "8x8 Work launched successfully." -ForegroundColor Green } else {