Want to get fancy with your SAM alerts? Do more than just be notified of an issue, take action. The following example will terminate all instances of notepad.exe on an alert status of Down using PowerShell:

  1. In the Trigger Action of the Advanced Alert, add a new action type of "Execute an external program."
  2. In the program to execute, type in "PowerShell" and the rest of the command line arguments or the path to your PowerShell script.
  3. Below is an example that terminates all running instances of notepad.exe.
    Note: You will need to enable impersonation through your PowerShell script or run the Advanced Alert Manager under a user account with elevated privileges.



Wrapping VBScript around an executable file.


The following example demonstrates how to write a simple vbscript to open notepad.exe - all from the comfort of your desktop:

1. Open Notepad and paste the following code into a new document:

    Set WshShell = WScript.CreateObject("WScript.Shell")
    Dim exeName
    Dim statusCode
    exeName = "%windir%\notepad"
    statusCode = WshShell.Run (exeName, 1, true)
    MsgBox("End of Program")

2. Save the file as Example.vbs (manually change the extension to .vbs)

3. Double-click Example.vbs to run the program which launches Notepad.exe

Note: Change the highlighted section to the path and exe you want to execute, for example, C:\Program Files\Mozilla Firefox\firefox.exe

Learning a few simple tips and tricks like this just may make your SysAdmin day a li'l bit brighter.