From 6778a5853ff5a54510386962827b8056f283ee56 Mon Sep 17 00:00:00 2001 From: CristianD Date: Mon, 24 Aug 2026 15:38:27 +0100 Subject: [PATCH] Update 8x8_Work_Updater.ps1 --- 8x8_Work_Updater.ps1 | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/8x8_Work_Updater.ps1 b/8x8_Work_Updater.ps1 index df9a442..6431a39 100644 --- a/8x8_Work_Updater.ps1 +++ b/8x8_Work_Updater.ps1 @@ -3,7 +3,7 @@ # 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. +# and relaunches 8x8 Work seamlessly. # ============================================================================== # Ensure script is running elevated @@ -94,10 +94,9 @@ Do If remaining <= 0 Then Exit Do ' 64 = Information Icon, 4096 = System Modal (Always on Top) - ' Return code 1 = OK clicked, -1 = Timeout expired / X closed intReturn = objShell.Popup(strMsg, remaining, "JCT600 IT Support - 8x8 Work Update", 64 + 4096) - ' If user clicked OK (1) or timer ran out, break loop + ' If user clicked OK (1), break loop If intReturn = 1 Then Exit Do Loop @@ -129,8 +128,8 @@ objFile.Close Start-Sleep -Seconds 2 } - # Cleanup scheduled task - schtasks.exe /Delete /TN $taskName /F | Out-Null + # Cleanup prompt task + schtasks.exe /Delete /TN $taskName /F 2>&1 | Out-Null } # -------------------------------------------------------------------------- @@ -160,8 +159,10 @@ objFile.Close Write-Host "Installation completed successfully." -ForegroundColor Green # -------------------------------------------------------------------------- - # Step 5: Relaunch 8x8 Work + # Step 5: Relaunch 8x8 Work via Explorer Shell # -------------------------------------------------------------------------- + Write-Host "Launching 8x8 Work..." -ForegroundColor Cyan + $possiblePaths = @( "${env:ProgramFiles}\8x8 Inc\8x8 Work\8x8 Work.exe", "${env:ProgramFiles(x86)}\8x8 Inc\8x8 Work\8x8 Work.exe", @@ -174,13 +175,17 @@ objFile.Close if ($exePath) { if (-not [string]::IsNullOrWhiteSpace($loggedUser)) { $launchTask = "JCT600_8x8_Launch" - schtasks.exe /Create /TN $launchTask /TR "`"$exePath`"" /SC ONCE /ST 00:00 /IT /RU "$loggedUser" /F | Out-Null + + # 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 - Start-Sleep -Seconds 2 - schtasks.exe /Delete /TN $launchTask /F | Out-Null - Write-Host "8x8 Work launched in user session." -ForegroundColor Green + + Start-Sleep -Seconds 5 + schtasks.exe /Delete /TN $launchTask /F 2>&1 | Out-Null + Write-Host "8x8 Work launched successfully in user session." -ForegroundColor Green } else { - Start-Process -FilePath $exePath + Start-Process "explorer.exe" -ArgumentList "`"$exePath`"" } } else { Write-Warning "Could not locate 8x8 Work executable."