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.
We will create an empty text file first and then create a program alert that will append to this file.
- Open Windows File Explorer.
- 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.
- Create a new text file, remember the name for use in the program alert.
- In our example C:\temp\gsxlog.txt.
- In GSX Monitor, edit the Alert profile you would like to add the program alert to.
- Select Programs - New, to open the Program Alert Configuration dialogue.
- 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: ' "
- You can also add the following variables inside the -Value ' ' argument:
- Click OK.
- Use the > arrow to add this alert to the selected profile.
- 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.