Contact Info

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 MS Dynamics monitoring check, do the following:

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.

Powershell Ms Dynamics check

MsDynamics.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:
#     MsDynamics.ps1
# Description: 
#     Checks if [strMsDynamics] is running; it checks the services and processes
# Declare Parameters:
#     1) strHost (string) - Hostname or IP address of the server you want to check
#     2) strVersion (string) - MS Dynamics Server version (either AX2012R2A, NAV2015, NAV2013, NAV2009,
#         CRM2015, CRM2013, CRM2011, CRM4, GP2013 or SL2011)
#     3) strAltCredentials (string, optional) - Specify an empty string to use Network Monitor service credentials.
#         To use alternate credentials, enter a server that is defined in Server Credentials table.
#         (To define Server Credentials, choose Tools->Options->Server Credentials)
# Usage:
#     .\MsDynamics.ps1 '<Hostname | IP>' '<MsDynamicsVersion>' '[alt-credentials]'
# Sample:
#     .\MsDynamics.ps1 'localhost' 'NAV 2009'
#################################################################################

# -- Declare Parameters
param ( [string]$strHost = '', [string]$strVersion = '', [string]$strAltCredentials = '' )

# -- Use _activexperts.ps1 with common functions 
. 'C:\Program Files (x86)\ActiveXperts\Network Monitor\Scripts\Monitor (ps1)\_activexperts.ps1' 


#################################################################################
# // --- Private Functions section ---
#################################################################################

function getSoftwareInfo( $strVersion, [ref]$lstServices, [ref]$lstProcesses, [ref]$lstPerfCounters )
{
  # Retrieve services, processes and counters associated to the specific version of the software. Entries that start 
  # with '!' are optional services/processes/counters and are not checked by default. Remove '!' mark to enable monitoring those items.

  switch( $strVersion )
  {
    'AX2012R2A'
    {
      $lstServices.value = @( @( 'AOS60$01', 'Microsoft Dynamics AX Object Server 6.2$01-MicrosoftDynamicsAX' ), 
                              @( 'AX2012R2A', 'Microsoft Dynamics AX for Commerce Data Exchange Synch Service' ),
                              @( 'DynAxSyncServer60', 'Microsoft Dynamics AX 2012 Synchronization Service' ),
                              @( '!Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 5.1', 'Microsoft Dynamics AXCommerce Data Exchange: Real-time Service 5.1' ),
                              @( '!Microsoft Dynamics AX Commerce Data Exchange: Real-time Service 6.1', 'Microsoft Dynamics AXCommerce Data Exchange: Real-time Service 6.1' ),
                              @( 'MSSQLSERVER', 'SQL Server (MSSQLSERVER)' ),
                              @( 'W3SVC', 'World Wide Web Publishing Service' ),
                              @( '', '' ) )
      $lstProcesses.value = @( 'Ax32Serv.exe', 'AxSynchronizationService.exe', 'DBServer.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }
      
      
    'NAV2015'
    {
      $lstServices.value = @( @( 'MicrosoftDynamicsNavServer$DynamicsNAV80', 'Microsoft Dynamics NAV Server [DynamicsNAV80]' ),
                              @( '!MSSQLSERVER', 'SQL Server (MSSQLSERVER)' ),
                              @( '!W3SVC', 'World Wide Web Publishing Service' ),
                              @( '', '' ) )
      $lstProcesses.value = @( 'Microsoft.Dynamics.Nav.Server.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }
    
    'NAV2013'
    {
      $lstServices.value = @( @( 'MicrosoftDynamicsNavServer$DynamicsNAV70', 'Microsoft Dynamics NAV Server [DynamicsNAV70]' ),
                              @( 'MSSQLSERVER', 'SQL Server (MSSQLSERVER)' ),
                              @( 'W3SVC', 'World Wide Web Publishing Service' ),
                              @( '', '' ) )
      $lstProcesses.value = @( 'Microsoft.Dynamics.Nav.Server.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }
      
    'NAV2009'
    {
      $lstServices.value = @( @( 'MicrosoftDynamicsNavServer$DynamicsNAV70', 'Microsoft Dynamics NAV Server [DynamicsNAV70]' ),
                              @( 'MSSQLSERVER', 'SQL Server (MSSQLSERVER)' ),
                              @( 'W3SVC', 'World Wide Web Publishing Service' ),
                              @( '', '' ) )
      $lstProcesses.value = @( 'Microsoft.Dynamics.Nav.Server.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }
      
 
    'CRM2015'
    {
      $lstServices.value = @( @( 'MSCRMAsyncService', 'Microsoft Dynamics CRM Asynchronous Processing Service' ),
                              @( '!MSCRMAsyncService$maintenance', 'Microsoft Dynamics CRM Asynchronous Processing Service (maintenance)' ),
                              @( 'MSCRMSandboxService', 'Microsoft Dynamics CRM Sandbox Processing Service' ),
                              @( 'MSCRMUnzipService', 'Microsoft Dynamics CRM Unzip Service' ),
                              @( '', '', '', '' ) )
      $lstProcesses.value = @( 'CrmAsyncService.exe', 'CrmUnzipService.exe', 'Microsoft.Crm.Sandbox.HostService.exe', '!Microsoft.Crm.Sandbox.WorkerProcess.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'CRM Server', 'Failed Organization Service Requests', '-lt 50' ),
                                  @( 'CRM Async Service', 'Total Operations Outstanding', '-lt 5' ),
                                  @( 'CRM Authentication', 'WindowsAuthenticationFailuresInTheLastMinute', '-lt 5' ),
                                  @( 'CRM Authentication', 'PassportAuthenticationFailuresInTheLastMinute', '-lt 5' ),
                                  @( 'CRM Async Service', 'Total Operations Failed', '<50' ),                       
                                  @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }
    
    'CRM2013'
    {
      $lstServices.value = @( @( 'MSCRMAsyncService', 'Microsoft Dynamics CRM Asynchronous Processing Service' ),
                              @( '!MSCRMAsyncService$maintenance', 'Microsoft Dynamics CRM Asynchronous Processing Service (maintenance)' ),
                              @( 'MSCRMSandboxService', 'Microsoft Dynamics CRM Sandbox Processing Service' ),
                              @( 'MSCRMUnzipService', 'Microsoft Dynamics CRM Unzip Service' ),
                              @( '', '', '', '' ) )
      $lstProcesses.value = @( 'CrmAsyncService.exe', 'CrmUnzipService.exe', 'Microsoft.Crm.Sandbox.HostService.exe', '!Microsoft.Crm.Sandbox.WorkerProcess.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'CRM Server', 'Failed Organization Service Requests', '-lt 50' ),
                                  @( 'CRM Async Service', 'Total Operations Outstanding', '-lt 5' ),
                                  @( 'CRM Authentication', 'WindowsAuthenticationFailuresInTheLastMinute', '-lt 5' ),
                                  @( 'CRM Authentication', 'PassportAuthenticationFailuresInTheLastMinute', '-lt 5' ),
                                  @( 'CRM Async Service', 'Total Operations Failed', '<50' ),                       
                                  @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }

    'CRM2011'
    {
      $lstServices.value = @( @( 'MSCRMAsyncService', 'Microsoft Dynamics CRM Asynchronous Processing Service' ),
                              @( '!MSCRMAsyncService$maintenance', 'Microsoft Dynamics CRM Asynchronous Processing Service (maintenance)' ),
                              @( 'MSCRMSandboxService', 'Microsoft Dynamics CRM Sandbox Processing Service' ),
                              @( 'MSCRMUnzipService', 'Microsoft Dynamics CRM Unzip Service' ),
                              @( '', '', '', '' ) )
      $lstProcesses.value = @( 'CrmAsyncService.exe', 'CrmUnzipService.exe', 'Microsoft.Crm.Sandbox.HostService.exe', '!Microsoft.Crm.Sandbox.WorkerProcess.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'CRM Server', 'Failed Organization Service Requests', '-lt 50' ),
                                  @( 'CRM Async Service', 'Total Operations Outstanding', '-lt 5' ),
                                  @( 'CRM Authentication', 'WindowsAuthenticationFailuresInTheLastMinute', '-lt 5' ),
                                  @( 'CRM Authentication', 'PassportAuthenticationFailuresInTheLastMinute', '-lt 5' ),
                                  @( 'CRM Async Service', 'Total Operations Failed', '-lt 50' ),                       
                                  @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }
                        
    'CRM4'
    {
      $lstServices.value = @( @( 'MSCRMAsyncService', 'Microsoft Dynamics CRM Asynchronous Processing Service' ),
                              @( 'MSSQLSERVER', 'SQL Server (MSSQLSERVER)' ),
                              @( 'W3SVC', 'World Wide Web Publishing Service' ),
                              @( '', '' ) )
      $lstProcesses.value = @( 'CrmAsyncService.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'CRM Server', 'Failed CrmService Requests', '-lt 50' ),
                                  @( 'CRM Async Service', 'mscrmasyncservice', 'Total Operations Outstanding', '-lt 5' ),
                                  @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }
 
     'GP2013'
    {
      $lstServices.value = @( @( 'MSSQLSERVER', 'SQL Server (MSSQLSERVER)' ),
                              @( '', '' ) )
      $lstProcesses.value    = @( 'dpm.exe', 'dynamics.exe', 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    } 
    
    'SL2011'
    {
      $lstServices.value = @( @( 'MSSQLSERVER', 'SQL Server (MSSQLSERVER)' ),
                              @( 'W3SVC', 'World Wide Web Publishing Service' ),
                              @( '', '' ) )
      $lstProcesses.value    = @( 'sqlservr.exe', '' )
      $lstPerfCounters.value = @( @( 'Memory', 'Available Bytes', '-gt 104857600' ),
                                  @( 'Processor', '_TOTAL', '% Processor Time', '-lt 90' ),
                                  @( '', '', '', '' ) )
      return $AXSUCCESS
    }            
      
    default
    {
      $lstServices.value = @( , @( '', '' ) )
      $lstProcesses.value = @( , '' )
      $lstPerfCounters.value = @( , @( '', '','','' ) )
      return $AXERROR
    }
  }
}


#################################################################################
# // --- Main script ---
#################################################################################

# -- Clear screen and clear error
cls
$Error.Clear()

# -- Validate parameters, return on parameter mismatch
if( $strHost -eq '' -or $strVesion -eq '' )
{
  $res = 'UNCERTAIN: Parameter error - Usage: .\MsDynamics.ps1 "<Hostname | IP>" "<MsDynamicsVersion>" "[alt-credentials]"'
  echo $res
  exit
}

# Declare local variables by assigning an initial value to it
$lstServices = $null
$lstProcesses = $null
$lstPerfCounters = $null

$objAltCredentials = $null
$strExplanation = ''

# If alternate credentials are specified, retrieve the alternate login and password from the ActiveXperts global settings
if( $strAltCredentials -ne '' )
{
  # Get the Alternate Credentials object. Function "AxGetCredentials" is implemented in "activexperts.ps1"
  if( ( AxGetCredentials $strHost  $strAltCredentials ([ref]$objAltCredentials) ([ref]$strExplanation) ) -ne $AXSUCCESS )
  {
    echo $strExplanation
    exit
  }
}

# Retrieve product processes/services/performance-counters list
if( ( getSoftwareInfo $strVersion ([ref]$lstServices) ([ref]$lstProcesses) ([ref]$lstPerfCounters) ) -ne $AXSUCCESS )
{ 
  $res = 'ERROR: Version [' + $strVersion + '] is not supported.'
  echo $res
  exit
}

# -- Check services
if( ( AxCheckServices $strHost ([ref]$lstServices) $objAltCredentials ([ref]$strExplanation) ) -ne $AXSUCCESS )
{
  echo $strExplanation
  exit
}

# -- Check processes
if( ( AxCheckProcesses $strHost ([ref]$lstProcesses) $objAltCredentials ([ref]$strExplanation) ) -ne $AXSUCCESS )
{
  echo $strExplanation
  exit
}

# -- Check performance counters
if( ( AxCheckPerfCounters $strHost ([ref]$lstPerfCounters) $objAltCredentials ([ref]$strExplanation) ) -ne $AXSUCCESS )
{
  echo $strExplanation
  exit
}

# -- Print script result
$res = 'SUCCESS: All services, processes and counters successfully checked'
echo $res
exit


#################################################################################
# // --- Catch script exceptions ---
#################################################################################

trap [Exception]
{
  $res = 'UNCERTAIN: ' + $_.Exception.Message
  echo $res
  exit
}