Update 8x8_Work_Updater.ps1
This commit is contained in:
+14
-20
@@ -1,9 +1,8 @@
|
||||
# ==============================================================================
|
||||
# Script Name: Update-8x8Work-DualSession.ps1
|
||||
# Description: Downloads 8x8, launches a zero-console interactive JCT600 GUI
|
||||
# in the active user's session via VBScript wrapper (BOM fixed),
|
||||
# waits for completion/override (1-hour countdown), silently installs,
|
||||
# launches 8x8 as standard user, and cleans up tasks.
|
||||
# Script Name: 8x8_Work_Updater.ps1
|
||||
# Description: Downloads 8x8, launches an interactive JCT600 GUI attached to
|
||||
# the active user's desktop via schtasks /IT, waits for response,
|
||||
# silently installs, relaunches 8x8 Work, and cleans up.
|
||||
# ==============================================================================
|
||||
|
||||
# Ensure script is running elevated
|
||||
@@ -159,7 +158,7 @@ WshShell.Run "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "
|
||||
[System.IO.File]::WriteAllText($vbsScript, $vbsContent, [System.Text.Encoding]::ASCII)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Step 3: Trigger Interactive GUI via VBS Wrapper in User's Session
|
||||
# Step 3: Trigger Interactive GUI Attached to User Desktop WindowStation
|
||||
# --------------------------------------------------------------------------
|
||||
Write-Host "[3/5] Launching dialog in active user's desktop session..." -ForegroundColor Cyan
|
||||
|
||||
@@ -176,11 +175,10 @@ WshShell.Run "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "
|
||||
} else {
|
||||
Write-Host "Detected active user: $loggedUser" -ForegroundColor Green
|
||||
|
||||
$action = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$vbsScript`""
|
||||
$principal = New-ScheduledTaskPrincipal -UserId $loggedUser -LogonType Interactive -RunLevel Limited
|
||||
|
||||
Register-ScheduledTask -TaskName $taskName -Action $action -Principal $principal -Force | Out-Null
|
||||
Start-ScheduledTask -TaskName $taskName
|
||||
# Register task using schtasks.exe /IT to force GUI attachment to active screen station
|
||||
$trCommand = "wscript.exe `"$vbsScript`""
|
||||
& schtasks.exe /Create /TN $taskName /TR $trCommand /SC ONCE /ST 00:00 /RU $loggedUser /IT /F | Out-Null
|
||||
& schtasks.exe /Run /TN $taskName | Out-Null
|
||||
|
||||
Write-Host "Waiting for user dialog response or timer expiration (1 hour max)..." -ForegroundColor Yellow
|
||||
while (-not (Test-Path $flagFile)) {
|
||||
@@ -215,7 +213,7 @@ WshShell.Run "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "
|
||||
Write-Host "Installation completed successfully." -ForegroundColor Green
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Step 5: Launch 8x8 Work under Active User Account
|
||||
# Step 5: Launch 8x8 Work in User Desktop Session
|
||||
# --------------------------------------------------------------------------
|
||||
Write-Host "[5/5] Launching 8x8 Work in user session..." -ForegroundColor Cyan
|
||||
|
||||
@@ -230,15 +228,11 @@ WshShell.Run "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "
|
||||
|
||||
if ($exePath) {
|
||||
if (-not [string]::IsNullOrEmpty($loggedUser)) {
|
||||
# Launch 8x8 via standard user Scheduled Task to avoid Admin elevation GPU context crashes
|
||||
$launchTask = "JCT600_8x8_AppLaunch"
|
||||
$launchAction = New-ScheduledTaskAction -Execute "$exePath"
|
||||
$launchPrincipal = New-ScheduledTaskPrincipal -UserId $loggedUser -LogonType Interactive -RunLevel Limited
|
||||
|
||||
Register-ScheduledTask -TaskName $launchTask -Action $launchAction -Principal $launchPrincipal -Force | Out-Null
|
||||
Start-ScheduledTask -TaskName $launchTask
|
||||
& schtasks.exe /Create /TN $launchTask /TR "`"$exePath`"" /SC ONCE /ST 00:00 /RU $loggedUser /IT /F | Out-Null
|
||||
& schtasks.exe /Run /TN $launchTask | Out-Null
|
||||
Start-Sleep -Seconds 3
|
||||
Unregister-ScheduledTask -TaskName $launchTask -Confirm:$false -ErrorAction SilentlyContinue
|
||||
& schtasks.exe /Delete /TN $launchTask /F | Out-Null
|
||||
Write-Host "8x8 Work launched successfully for $loggedUser." -ForegroundColor Green
|
||||
} else {
|
||||
Start-Process -FilePath $exePath
|
||||
@@ -252,7 +246,7 @@ WshShell.Run "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "
|
||||
# Mandatory Cleanup
|
||||
# --------------------------------------------------------------------------
|
||||
Write-Host "Cleaning up scheduled task and temporary files..." -ForegroundColor Gray
|
||||
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
|
||||
& schtasks.exe /Delete /TN $taskName /F 2>$null | Out-Null
|
||||
|
||||
if (Test-Path $workDir) {
|
||||
Remove-Item $workDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Reference in New Issue
Block a user