diff --git a/8x8_Work_Updater.ps1 b/8x8_Work_Updater.ps1 index 6431a39..9ce3b21 100644 --- a/8x8_Work_Updater.ps1 +++ b/8x8_Work_Updater.ps1 @@ -1,9 +1,8 @@ # ============================================================================== # Script Name: 8x8_Work_Updater.ps1 -# Description: Downloads 8x8 with a progress bar, schedules and launches an unclosable -# VBScript interactive countdown directly in the user session, -# waits for user confirmation or 1-hour timeout, silently installs, -# and relaunches 8x8 Work seamlessly. +# Description: Downloads 8x8 with a progress bar, launches an unclosable HTA +# countdown prompt in the user's session (no X button), waits for +# user action or 1-hour timeout, installs silently, and relaunches 8x8. # ============================================================================== # Ensure script is running elevated @@ -16,7 +15,7 @@ Add-Type -AssemblyName System.Net.Http $workDir = "C:\ProgramData\JCT600_8x8Update" $flagFile = Join-Path $workDir "8x8_Update_Proceed.flag" -$vbsScript = Join-Path $workDir "Show-8x8Prompt.vbs" +$htaPromptPath = Join-Path $workDir "Show-8x8Prompt.hta" $installerPath = Join-Path $workDir "8x8_Work_Installer.msi" if (-not (Test-Path $workDir)) { @@ -71,45 +70,131 @@ try { } # -------------------------------------------------------------------------- - # Step 2: Generate Persistent VBScript UI Dialog (Cannot be dismissed via X) + # Step 2: Generate Unclosable HTA Countdown Dialog (No Close/X Button) # -------------------------------------------------------------------------- - Write-Host "[2/4] Generating user dialog..." -ForegroundColor Cyan + Write-Host "[2/4] Generating unclosable dialog..." -ForegroundColor Cyan - $vbsContent = @" -Set objShell = CreateObject("WScript.Shell") -Set objFSO = CreateObject("Scripting.FileSystemObject") + $htaContent = @" + + + + JCT600 IT Support — 8x8 Work Update + + + + + +
JCT600 — IT SUPPORT
+
+ An automatic update for 8x8 Work has been scheduled.
+ Please save active work or click Update Now to begin. +
+
60:00
+ + + "@ - [System.IO.File]::WriteAllText($vbsScript, $vbsContent, [System.Text.Encoding]::ASCII) + [System.IO.File]::WriteAllText($htaPromptPath, $htaContent, [System.Text.Encoding]::ASCII) # -------------------------------------------------------------------------- - # Step 3: Launch Native Dialog inside Active User Session + # Step 3: Launch Unclosable Dialog in Active User Session # -------------------------------------------------------------------------- Write-Host "[3/4] Launching prompt on logged-in user desktop..." -ForegroundColor Cyan @@ -120,10 +205,11 @@ objFile.Close } else { $taskName = "JCT600_8x8_UpdatePrompt" - schtasks.exe /Create /TN $taskName /TR "wscript.exe `"$vbsScript`"" /SC ONCE /ST 00:00 /IT /RU "$loggedUser" /F | Out-Null + # mshta.exe runs the HTML Application natively inside the user's interactive desktop + schtasks.exe /Create /TN $taskName /TR "mshta.exe `"$htaPromptPath`"" /SC ONCE /ST 00:00 /IT /RU "$loggedUser" /F | Out-Null schtasks.exe /Run /TN $taskName | Out-Null - Write-Host "Prompt sent to $loggedUser. Waiting for user confirmation or 1-hour expiration..." -ForegroundColor Yellow + Write-Host "Prompt active for $loggedUser. Waiting for user action or timer expiration..." -ForegroundColor Yellow while (-not (Test-Path $flagFile)) { Start-Sleep -Seconds 2 } @@ -175,9 +261,8 @@ objFile.Close if ($exePath) { if (-not [string]::IsNullOrWhiteSpace($loggedUser)) { $launchTask = "JCT600_8x8_Launch" - - # Using explorer.exe inside the scheduled task ensures the UI process spawns detached into the user shell $taskRunCmd = "explorer.exe `"$exePath`"" + schtasks.exe /Create /TN $launchTask /TR "$taskRunCmd" /SC ONCE /ST 00:00 /IT /RU "$loggedUser" /F | Out-Null schtasks.exe /Run /TN $launchTask | Out-Null