Advertisement
SemlerPDX

Monitor VoiceAttack for Crash and Restart as Admin with UAC at High via Scheduled Task

Sep 13th, 2020 (edited)
2,489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #VoiceAttack restart by SemlerPDX May2020/Aug2020
  2. #uses Windows Task to launch VoiceAttack as Admin while bypassing UAC
  3. #current task is set to ensure Logitech G933 is set as input device, to my ".Malcolm for VAS90" profile
  4.  
  5. #Find complete instructions for Launching VoiceAttack as Admin under High UAC Settings with no UAC Prompt here:
  6. #     https://forum.voiceattack.com/smf/index.php?topic=3517.msg16179
  7.  
  8.  
  9. # Launch VoiceAttack if not running
  10. if (!(Get-Process -Name VoiceAttack*)) {
  11.     clear
  12.     # Process Begin
  13.     $bTimeDown = 3
  14.     for($b=$bTimeDown; $b -gt -1; $b--) {
  15.         write-host "Starting VoiceAttack in $($b) seconds..."
  16.         start-sleep -seconds 1
  17.         clear
  18.     }
  19.     write-host "$(Get-Date) - Launching VoiceAttack to .Malcolm for VAS90..."
  20.     start-sleep -seconds 1
  21.     if (!(Get-Process -Name VoiceAttack*)) {
  22.         Start-ScheduledTask -TaskName "VAnoUACg933"
  23.     }
  24. }
  25.  
  26. # Delayed Monitor Start
  27. $dTimeDown = 15
  28. for($d=$dTimeDown; $d -gt -1; $d--) {
  29.     write-host "Starting Crash Monitor for VoiceAttack in $($d) seconds..."
  30.     start-sleep -seconds 1
  31.     clear
  32. }
  33.  
  34. write-host "$(Get-Date) - Monitoring VoiceAttack for crashes..."
  35. # VoiceAttack Crash Monitor Loop
  36. do {
  37.     start-sleep -seconds 1
  38.     if (!(Get-Process -Name VoiceAttack*)) {
  39.         clear
  40.         # Crash Handle Start
  41.         $sTimeDown = 4
  42.         for($s=$sTimeDown; $s -gt -1; $s--) {
  43.             write-host "$(Get-Date) - .Malcolm for VAS90 has crashed VoiceAttack.... Restarting in $($s) seconds..."
  44.             start-sleep -seconds 1
  45.             clear
  46.         }
  47.         write-host "$(Get-Date) - Launching VoiceAttack to .Malcolm for VAS90..."
  48.         start-sleep -seconds 1
  49.         if (!(Get-Process -Name VoiceAttack*)) {
  50.             Start-ScheduledTask -TaskName "VAnoUACg933"
  51.         }
  52.         clear
  53.         # Delayed Monitor Start
  54.         $rTimeDown = 15
  55.         for($r=$rTimeDown; $r -gt -1; $r--) {
  56.             write-host "Starting Crash Monitor for VoiceAttack in $($r) seconds..."
  57.             start-sleep -seconds 1
  58.             clear
  59.         }
  60.         write-host "$(Get-Date) - Monitoring VoiceAttack for crashes..."
  61.     }
  62. } while ($true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement