Miscellaneous-ShowDebugger.ps1 - ActiveXperts Network Monitor PowerShell check
ActiveXperts Network Monitor ships with a powerful set of pre-defined checks. Each individual check has a static number of configuration items. To monitor other items, or to combine monitoring items, you can make use of custom PowerShell checks.
Most of the built-in checks have a PowerShell equivalent, implemented as a PowerShell (.ps1) script file. Out-of-the-box, each PowerShell script monitors the same items as the built-in check. Feel free to modify the script.
To add a new PowerShell-based ShowDebugger monitoring check, do the following:
- On the 'Monitor menu', open 'New Monitoring Check (Script)' and choose 'New PowerShell Check'. The 'PowerShell Check' dialog box appears;
- In the 'Script File' selection box, select 'Miscellaneous-ShowDebugger.ps1';
- In the 'Script Parameters'group box enter the required parameters. You can also load a working sample first by clicking on the 'Click here to load a sample' link.
To customize the above monitoring check, click on the 'Edit button' next to the 'Script File' selection box. Notepad will be launched. You can now make changes to the PowerShell script.
Miscellaneous-ShowDebugger.ps1 script source code
################################################################################# # ActiveXperts Network Monitor PowerShell script, (c) ActiveXperts Software B.V. # For more information about ActiveXperts Network Monitor, visit the ActiveXperts # Network Monitor web site at https://www.activexperts.com ################################################################################# # Script # Miscellaneous-ShowDebugger.ps1 # Description: # Count the number of files in a directory and all subsirectories # Parameters: # 1) strDebugFile - the name of the debug output file. The path of the file must be a valid path. # If the file does not exists, the file will be created. # Usage: # .\Miscellaneous-ShowDebugger.ps1 '<Debug File>' # Sample: # .\Miscellaneous-ShowDebugger.ps1 'c:\\file.log' ################################################################################# # Parameters param ( [string]$strDebugFile ) if ( $strDebugFile -eq "" ) { $res = "UNCERTAIN: Invalid number of parameters - Usage: .\Miscellaneous-ShowDebugger.ps1 '<Debug File>'" echo $res exit } $objDebugger = new-object -comobject ActiveXperts.VbDebugger $objDebugger.DebugFile = $strDebugFile $objDebugger.Enabled = 1 $objDebugger.ClearDebugFile() $dtCurrentDate = Get-Date $dtCurrentDate = $dtCurrentDate.ToString("M/d/yyyy h:mm:ss tt") $objDebugger.WriteLine("Debug file cleared at " + $dtCurrentDate) $objDebugger.WriteLine("Write information to the debug file") $objDebugger.Sleep(1000) $dtCurrentDate = Get-Date $dtCurrentDate = $dtCurrentDate.ToString("M/d/yyyy h:mm:ss tt") $objDebugger.WriteLine("ShowDebugger function ready at " + $dtCurrentDate) $objDebugger = $null $res = "SUCCESS: ShowDebugger function completed" echo $res exit