{}

Nos marques

Bienvenue sur le site Web de Schneider Electric

Bienvenue sur notre site Web.
Consulter notre FAQ
Power Monitoring Expert (PME) Task Scheduler tasks fail. Last run result 0x1F4. Powershell scripts output error "Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL"
Issue
Power Monitoring Expert (PME) uses scheduled tasks to trim, backup, etc the PME databases. In the task scheduler, the last run result is "0x1F4" indicating they failed. Using this Schneider official FAQ https://www.se.com/us/en/faqs/FA263465/ to run any of the PowerShell scripts manually, the debug error statement outputs the following (see bolded line):

An error occurred during the execution of the Maintenance task for ION_Network: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args)
at Microsoft.PowerShell.Commands.NewObjectCommand.SafeCreateInstance(Type t, Object[] args)
DEBUG: System.Management.Automation.MethodInvocationException: Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)" ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error
Locating Server/Instance Specified)

Product line
Power Monitoring Expert 8.x
Power Monitoring Expert 9.x
Power Monitoring Expert 2020
Power Monitoring Expert 2021
Power Monitoring Expert 2022
Power Monitoring Expert 2023

Environment
Task Scheduler
SQL Server Management Studio (SSMS)
Powershell

Cause
A file in the DbScheduledTasks folder "DatabaseHelper.ps1" includes variables that define the PME system. The default parameter assumes the system is using the default instance of SQL, "ION." If the user is not using the default and has a new name, the connection to the database fails. Two options to find the SQL instance name are SQL Server Management Studio (SSMS) or the PME diagnostics tool.

In SSMS, the instance name can be automatically detected when the application is launched. To open the PME diagnostics tool, refer to the PME system guide or to this Schneider official FAQ https://www.se.com/us/en/faqs/FA275753/ . Click "select none" to deselect the checked items. Scroll to the box that says "SQL server information" and check it. The generated .html file "called SQL Server Information" contains the SQL instance name and version at the top.

Resolution
  1. Open the file \Power Monitoring Expert\config\cfg\DbScheduledTasks\Support\DatabaseHelper.ps1. (If your PME is a distributed system, a custom location on the database server will contain this file.)
  2. Use ctrl+f to find the variable "$sqlInstanceName." Set the variable equal to your PME SQL instance name, or to an empty string "". If you are using the default it would remain, $sqlInstanceName = "ION"
  3. Attempt to run a script from Powershell to test functionality
  4. If the same error message appears, use this Schneider official Youtube video https://www.youtube.com/watch?v=XJmUCK5uqPY to check that a connection to the SQL databases can be made from the server.

Schneider Electric Belgium