MFSQL <database> - Set Assembly Update Flag¶
Also creates: Alert MFSQL <database> - M-Files Update Detected
Integration Connector only.
Job Definition¶
Job name:
MFSQL <database> - Set Assembly Update FlagAlert name:
MFSQL <database> - M-Files Update DetectedOwner:
saCategory: Database Maintenance
Schedule: none - triggered entirely by the alert, not time-based
Alert fires on: any write to
HKLM\SOFTWARE\Motive\M-Files(WMIRegistryKeyChangeEvent), throttled to at most once every 30 seconds
Purpose¶
Primary, immediate-detection path for keeping the CLR/Interop assemblies in sync
with the installed M-Files client version. When M-Files auto-updates on the SQL
Server, it writes a new version subkey under HKLM\SOFTWARE\Motive\M-Files;
the alert fires within seconds and the job:
Enumerates the M-Files registry subkeys to find the latest installed version, polling for up to ~30 minutes if the registry is transiently empty (M-Files removes the old version subkey before writing the new one during an upgrade, so a single alert firing can otherwise land in that empty window).
Compares it against
MFSettings.MFVersion.On a real change, delegates to spMFCheckAndUpdateAssemblyVersion, which sets
MFSettings.MFilesUpdatePending, reloads the assemblies via spMFUpdateAssemblies, and logs the reload (MFProcessBatch/MFProcessBatchDetail,MFLogon failure).
See Validate M-Files Version Agent for the daily fallback that covers the rare case where an alert firing is missed entirely.
Diagnostics¶
If automatic detection is not working, check whether the alert actually exists.
Note that msdb.dbo.sysalerts has no wmi_namespace/wmi_query columns:
sp_add_alert stores a WMI alert’s namespace in database_name and its query
in performance_condition:
SELECT name, enabled,
database_name AS wmi_namespace,
performance_condition AS wmi_query
FROM msdb.dbo.sysalerts
WHERE name = N'MFSQL <database> - M-Files Update Detected';
SELECT name, enabled FROM msdb.dbo.sysjobs
WHERE name = N'MFSQL <database> - Set Assembly Update Flag';
The job and the alert are created in separate batches, so it is possible for
one to exist without the other. If the alert is missing, this script records the
reason in MFLog – including the error returned by sp_add_alert and the
identity that executed it:
SELECT CreateDate, ErrorNumber, ErrorMessage, ProcedureStep FROM dbo.MFLog
WHERE SPName = '35.703.job.CreateMFilesUpdateAlert' ORDER BY LogID DESC;
Note that sp_add_alert requires membership of the sysadmin server role,
which is a stricter requirement than the job creation in Part 1. An
MFLog entry showing sysadmin=0 identifies that as the cause.
Prerequisites¶
SQL Server Agent must be running.
The Agent service account needs WMI access to
root\defaulton the local host - standard domain/local service accounts have this by default.On a server hosting more than one MFSQL application database, run this script once per database - the job step targets a specific application database.
Idempotency¶
Safe to re-run on an existing installation. Two self-heal mechanisms keep existing installs aligned with the on-disk script without operator intervention:
Step-content self-heal. If the existing job’s step body doesn’t match the current step version, the job (and its bound alert) is dropped and recreated with the current step - no manual “drop and recreate after every release” step required.
Owner self-heal. If the existing job is owned by the legacy
MFSQLConnectlogin, the owner is updated tosain place. An environment that has intentionally set a different sysadmin login as owner is left untouched.Stale-name cleanup (one-off, 5.13.38.82). During development this script named the job and alert with an em dash rather than a hyphen as the separator. Every name-keyed check here is keyed on the current name, so an em-dash-named pair would be missed and a second, hyphen-named pair created against the same WMI query - two jobs firing
spMFUpdateAssemblieson one registry write. The script now removes the em-dash-named job and alert first. This script is new in5.13.38.82and ships in no earlier bundle, so only internal test machines that ran a pre-release build can be affected; on every other install it is a silent no-op. No operator action is required either way.
If none of these conditions applies, re-running this script is a no-op for the existing job and alert.
Deployment¶
Ships in the Integration Connector deployment bundle and runs automatically during install/upgrade. Can also be re-run manually in SSMS against the target MFSQL application database.
Warnings¶
SQL Server Agent required. Skips cleanly (severity 10) on SQL Server
Express - neither this job nor the alert is created; call
spMFUpdateAssemblies manually after an M-Files upgrade
instead. Job/alert owner is sa; if sa is disabled or locked in a
hardened environment, the job and alert are still created but will fail to run
until sa is enabled, or the owner is manually changed to another sysadmin
login (e.g. leaving MFSQLConnect as a sysadmin, the standard install
posture).
Changelog¶
Date |
Author |
Description |
2026-07-30 |
AC |
|
2026-07-30 |
AC |
|
2026-05-28 |
AC |
|
2026-05-28 |
AC |
|
2026-05-27 |
AC |
|
2026-05-27 |
AC |
|
2026-05-20 |
AC |
Pre-flight check for the MFSQLConnect SQL login |
2026-04-22 |
AC |
|