Skip to main content
All CollectionsGeneral
VSA 10 Watcher deployment manual
VSA 10 Watcher deployment manual
D
Written by Dan Wixon
Updated over a week ago

The VSA 10 Watcher is a small script written in PowerShell that adds an entry to Windows Task Scheduler. In the unlikely event of VSA 10 service becoming unavailable, the newly created Task Scheduler entry will automatically restart the service.

In order to deploy it on a single machine please follow the following steps:

  1. Create a script

Navigate to WebApp - > Automation -> Scripts -> Build-In and select the New Script

Copy the script from the bottom section of this document, paste it and save as PowerShell

   2. Execute it

Navigate to WebApp -> Systems -> All Systems -> your_system_name -> Manage ->Scripts

Select the VSA 10 Watcher script

and execute it!

In order to deploy it on multiple machines please follow the following steps:

  1. Create a script

Navigate to WebApp - > Automation -> Scripts -> Build-In and select the New Script

Copy the script from the bottom section of this document, paste it and save as PowerShell:

   2. Create a task and run it

Navigate to WebApp - > Automation -> Tasks and select the Create Task  

Fill out the Overview tab and select your scope from the drop down menu

In the Script tab select the VSA 10 Watcher script and add it to the task by selecting the “+” sign. You can now save it.

Once completed go back to the Task section and run it in the usual manner.

Script:

#Create the scheduled task VSAX Watcher 
# https://www.vsax.com/download/startcheck.txt 
Path for the VSAX watcher
$file = $false $workdir = $Env:WinDir
# Check if work directory exists if not create it
try{     #check if the file exists. If yes, then delete it'     $file = Test-Path -Path "$workdir\vsax_watcher.cmd"     If ($file)     { Remove-Item -Path "$workdir\vsax_watcher.cmd" -force     Write-Host "The file was updated"     }
# Download the VSAX watcher
    $source = "https://www.vsax.com/download/startcheck.txt"     $destination = "$workdir\vsax_watcher.cmd"
    # Check if Invoke-Webrequest exists otherwise execute WebClient
        $WebClient = New-Object System.Net.WebClient         $webclient.DownloadFile($source, $destination)
    Start-Sleep -s 10
    # Check if the scheduled task 'VSAX watcher' exists, if not, then create it.     $taskExists = schtasks /query /TN "VSAX Watcher" 2>NULL    #$taskExists = Get-ScheduledTask -ErrorAction SilentlyContinue | Where-Object {$_.TaskName -like "VSAX Watcher" } | select state
    if($taskExists) {        Write-Host "The scheduled task 'VSAX Watcher' already exists"        exit 0     } else {        SCHTASKS /Create /SC MINUTE /MO 5 /TN "VSAX Watcher" /TR $destination /RU SYSTEM        Write-Host "The scheduled task 'VSAX Watcher' was created successfully"        exit 0     }     }catch{   Write-Host "An unexpected error occurred"   Break   exit 1 }

Did this answer your question?