miscellaneous-showdebugger.ps1 - powershell script by ActiveXperts Software
miscellaneous-showdebugger.ps1 prints debug information to a log file. Use it for debugging purposes.
Use miscellaneous-showdebugger.ps1 directly from ActiveXperts Network Monitor; in the Manager's 'Monitor' menu, select 'New Check (Script)' and select miscellaneous-showdebugger.ps1. Configure the required parameter, or press 'Load a working sample'.
In ActiveXperts Network Monitor, Administrators can use three different scripting languages: Powershell, VBScript and SSH.
miscellaneous-showdebugger.ps1 script code
################################################################################# # ActiveXperts Network Monitor PowerShell script, © ActiveXperts Software B.V. # For more information about ActiveXperts Network Monitor, visit the ActiveXperts # Network Monitor web site at http://www.activexperts.com ################################################################################# # Script # Miscellaneous-ShowDebugger.ps1 # Description: # Print debug information to a log file while the Network Monitor Engine interpreter runs the script. # Declare Parameters: # 1) strDebugFile (string) - 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:\network-monitor.log' ################################################################################# # -- Declare Parameters param( [string]$strDebugFile = '' ) # -- Use _activexperts.ps1 with common functions . 'C:\Program Files\ActiveXperts\Network Monitor\Scripts\Monitor (ps1)\_activexperts.ps1' ################################################################################# # // --- Main script --- ################################################################################# # -- Clear screen and clear error cls $Error.clear() # -- Validate parameters, return on parameter mismatch 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 # -- Print script result $res = 'SUCCESS: ShowDebugger function completed' echo $res exit ################################################################################# # // --- Catch script exceptions --- ################################################################################# trap [Exception] { $res = 'UNCERTAIN: ' + $_.Exception.Message echo $res exit }