Update 8x8_Work_Updater.ps1
This commit is contained in:
+16
-11
@@ -3,7 +3,7 @@
|
|||||||
# Description: Downloads 8x8 with a progress bar, schedules and launches an unclosable
|
# Description: Downloads 8x8 with a progress bar, schedules and launches an unclosable
|
||||||
# VBScript interactive countdown directly in the user session,
|
# VBScript interactive countdown directly in the user session,
|
||||||
# waits for user confirmation or 1-hour timeout, silently installs,
|
# waits for user confirmation or 1-hour timeout, silently installs,
|
||||||
# and relaunches 8x8 Work.
|
# and relaunches 8x8 Work seamlessly.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# Ensure script is running elevated
|
# Ensure script is running elevated
|
||||||
@@ -94,10 +94,9 @@ Do
|
|||||||
If remaining <= 0 Then Exit Do
|
If remaining <= 0 Then Exit Do
|
||||||
|
|
||||||
' 64 = Information Icon, 4096 = System Modal (Always on Top)
|
' 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)
|
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
|
If intReturn = 1 Then Exit Do
|
||||||
Loop
|
Loop
|
||||||
|
|
||||||
@@ -129,8 +128,8 @@ objFile.Close
|
|||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cleanup scheduled task
|
# Cleanup prompt task
|
||||||
schtasks.exe /Delete /TN $taskName /F | Out-Null
|
schtasks.exe /Delete /TN $taskName /F 2>&1 | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@@ -160,8 +159,10 @@ objFile.Close
|
|||||||
Write-Host "Installation completed successfully." -ForegroundColor Green
|
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 = @(
|
$possiblePaths = @(
|
||||||
"${env:ProgramFiles}\8x8 Inc\8x8 Work\8x8 Work.exe",
|
"${env:ProgramFiles}\8x8 Inc\8x8 Work\8x8 Work.exe",
|
||||||
"${env:ProgramFiles(x86)}\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 ($exePath) {
|
||||||
if (-not [string]::IsNullOrWhiteSpace($loggedUser)) {
|
if (-not [string]::IsNullOrWhiteSpace($loggedUser)) {
|
||||||
$launchTask = "JCT600_8x8_Launch"
|
$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
|
schtasks.exe /Run /TN $launchTask | Out-Null
|
||||||
Start-Sleep -Seconds 2
|
|
||||||
schtasks.exe /Delete /TN $launchTask /F | Out-Null
|
Start-Sleep -Seconds 5
|
||||||
Write-Host "8x8 Work launched in user session." -ForegroundColor Green
|
schtasks.exe /Delete /TN $launchTask /F 2>&1 | Out-Null
|
||||||
|
Write-Host "8x8 Work launched successfully in user session." -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Start-Process -FilePath $exePath
|
Start-Process "explorer.exe" -ArgumentList "`"$exePath`""
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Warning "Could not locate 8x8 Work executable."
|
Write-Warning "Could not locate 8x8 Work executable."
|
||||||
|
|||||||
Reference in New Issue
Block a user