Update 8x8_Work_Updater.ps1
This commit is contained in:
+20
-6
@@ -1,6 +1,6 @@
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Script Name: 8x8_Work_Updater.ps1
|
# Script Name: 8x8_Work_Updater.ps1
|
||||||
# Description: Downloads 8x8 with a progress bar, schedules and launches a native
|
# 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.
|
||||||
@@ -71,7 +71,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Step 2: Generate VBScript UI Dialog
|
# Step 2: Generate Persistent VBScript UI Dialog (Cannot be dismissed via X)
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
Write-Host "[2/4] Generating user dialog..." -ForegroundColor Cyan
|
Write-Host "[2/4] Generating user dialog..." -ForegroundColor Cyan
|
||||||
|
|
||||||
@@ -83,10 +83,25 @@ strMsg = "An automatic update for 8x8 Work has been scheduled by IT Support." &
|
|||||||
"Please save your active work and finish ongoing calls." & vbCrLf & vbCrLf & _
|
"Please save your active work and finish ongoing calls." & vbCrLf & vbCrLf & _
|
||||||
"Click OK to update now, or the update will proceed automatically in 60 minutes."
|
"Click OK to update now, or the update will proceed automatically in 60 minutes."
|
||||||
|
|
||||||
' 64 = Information Icon, 4096 = System Modal (Always On Top)
|
startTime = Timer
|
||||||
intReturn = objShell.Popup(strMsg, 3600, "JCT600 IT Support - 8x8 Work Update", 64 + 4096)
|
totalSeconds = 3600
|
||||||
|
|
||||||
' Create flag file when user clicks OK or when 3600 seconds expire
|
Do
|
||||||
|
elapsed = Timer - startTime
|
||||||
|
If elapsed < 0 Then elapsed = elapsed + 86400 ' Handle midnight rollover
|
||||||
|
remaining = Int(totalSeconds - elapsed)
|
||||||
|
|
||||||
|
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 intReturn = 1 Then Exit Do
|
||||||
|
Loop
|
||||||
|
|
||||||
|
' Create flag file to signal main script
|
||||||
Set objFile = objFSO.CreateTextFile("$flagFile", True)
|
Set objFile = objFSO.CreateTextFile("$flagFile", True)
|
||||||
objFile.WriteLine("proceed")
|
objFile.WriteLine("proceed")
|
||||||
objFile.Close
|
objFile.Close
|
||||||
@@ -106,7 +121,6 @@ objFile.Close
|
|||||||
} else {
|
} else {
|
||||||
$taskName = "JCT600_8x8_UpdatePrompt"
|
$taskName = "JCT600_8x8_UpdatePrompt"
|
||||||
|
|
||||||
# Schedule task to run interactively under the logged-on user account
|
|
||||||
schtasks.exe /Create /TN $taskName /TR "wscript.exe `"$vbsScript`"" /SC ONCE /ST 00:00 /IT /RU "$loggedUser" /F | Out-Null
|
schtasks.exe /Create /TN $taskName /TR "wscript.exe `"$vbsScript`"" /SC ONCE /ST 00:00 /IT /RU "$loggedUser" /F | Out-Null
|
||||||
schtasks.exe /Run /TN $taskName | Out-Null
|
schtasks.exe /Run /TN $taskName | Out-Null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user