www.gsx.com | log in | register

Last update: . Author: Alan Carson .

How to Write a GSX Monitor Alert to a Text File

You may want to keep a permanent record of Alerts sent by GSX Monitor in a separate text file that can be viewed later. We can add a program alert to the chosen alerting profile that will append to a text file using PowerShell.

GSX Monitor 10.x.x+ | Alerts

Instructions

We will create an empty text file first and then create a program alert that will append to this file.

  1. Open Windows File Explorer.
  2. Navigate to the folder you would like to create the text files in.
    • This cannot be a network folder if running GSX service as Local System.
  3. Create a new text file, remember the name for use in the program alert.
    • In our example C:\temp\gsxlog.txt.
  4. In GSX Monitor, edit the Alert profile you would like to add the program alert to.
  5. Select Programs - New, to open the Program Alert Configuration dialogue.
  6. Give the profile a name and add the following in the command line box:
    • powershell.exe "Add-Content -Path 'C:\temp\gsxlog.txt' -Value 'Alias- $Alias with error $AlertMsg'"
    • Notice the use of " (double quotes) and ' (single quotes), the command line will end with both a single quote and double quote: ' "
      textFile.png
    • You can also add the following variables inside the -Value ' ' argument:
      • $StationName
      • $AlertType
      • $Date
      • $Status
      • $Class
      • $SubResource
      • $Resource
  7. Click OK.
  8. Use the > arrow to add this alert to the selected profile.
  9. Once added it will display in the top right-hand side pane.

Now when this alert profile is triggered, it will write the error message contained in the variable $AlertMsg to the text file as specified.


Was this article helpful?

1 out of 1 found this helpful




Not finding what you are looking for?

Have more questions? Submit a request