NetXMS Support Forum

English Support => General Support => Topic started by: Darren Leggett on September 25, 2025, 03:55:02 PM

Title: Automatic Bind Rule for MSSQL servers
Post by: Darren Leggett on September 25, 2025, 03:55:02 PM
Hi

I've got a number of Windows Servers running a variety of different versions of MSSQL server.  I was wondering if anyone has come up with an Automatic Bind rule that can be used to bind them to a container.

Title: Re: Automatic Bind Rule for MSSQL servers
Post by: Benjamin Dill on September 25, 2025, 05:16:58 PM
Im using this metric (deployed by a template attached to all Windows systems):
ExternalMetric = MSSQL.InstalledInstancesCount:powershell -NonInteractive -NoProfile -Command "& { (Get-ItemProperty \"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\").InstalledInstances.Count }"

Then you can use something like this in automatic bind/auto apply:
value = $node.readAgentParameter("MSSQL.InstalledInstancesCount");
return (value != NULL && typeof(value) == "int32" && value > 0);
Title: Re: Automatic Bind Rule for MSSQL servers
Post by: Darren Leggett on September 26, 2025, 04:14:43 PM
Thanks, that's was exactly what I needed.