Filtering out SQL Server Express instances

dmitrib
Kilo Contributor

Hi all,

 

I've been researching a way to filter out / ignore SQL Server Express instances when MS SQL Server Discovery runs.

Some suggested this should be done under the Process Classifiers, but I don't think this is correct. I believe the probe for MS-SQL should be modified to figure out whether the instance of SQL Server is an Express version, then the sensor can be modified to check for that field and flag the CMDB entry appropriately.

 

Has anyone done this - ignored SQL Server Express editions while running Discovery?

 

Thanks,

Dmitri

1 ACCEPTED SOLUTION

Dmitri/William:
I think adding on to the MS SQL Server Process Classification makes sense. The 'Microsoft SQL Server' process classification triggers the 'Powershell-Windows - MSSQL' probe.



You can either add a new probe to do this or update the existing sqlinfo.ps1 script to filter out SQLServerExpress editions. To test for SQLServerExpress you can probe for the serverproperty 'edition'.



How to: Identify a SQL Server Express Instance



And you should be able to invoke the sqlcmd using invoke-expression ('iex')
Invoke-Expression



In PowerShell, something similar to the following should do it


#Create command


$cmd = 'sqlcmd' "select serverproperty('edition') go"



#Run command


iex "& $cmd"



I have not tried it out but the logic should work, please keep us posted on your findings, thanks,


Subash Biswas


View solution in original post

4 REPLIES 4

williamsun
Mega Guru

I am not entirely sure how discovery works as I do not use that product, but I think you could also do this with a transform script to validate the name or part of the name of the software and then skip that row.


Dmitri/William:
I think adding on to the MS SQL Server Process Classification makes sense. The 'Microsoft SQL Server' process classification triggers the 'Powershell-Windows - MSSQL' probe.



You can either add a new probe to do this or update the existing sqlinfo.ps1 script to filter out SQLServerExpress editions. To test for SQLServerExpress you can probe for the serverproperty 'edition'.



How to: Identify a SQL Server Express Instance



And you should be able to invoke the sqlcmd using invoke-expression ('iex')
Invoke-Expression



In PowerShell, something similar to the following should do it


#Create command


$cmd = 'sqlcmd' "select serverproperty('edition') go"



#Run command


iex "& $cmd"



I have not tried it out but the logic should work, please keep us posted on your findings, thanks,


Subash Biswas


Subash,



This is perfect. Thank you for finding and explaining this.


As my first step, I will follow the requirements for the MID Servers that do Discovery for us:


Microsoft SQL Servers - ServiceNow Wiki



As a second step, I will follow your steps above in modifying the probe / sensor. In fact, I might just have to modify the sensor to check the current.edition field for "Express Edition".



Thanks again,


Dmitri


Sharon Hobart
Mega Guru

Could you not also mark the "MySQL Server" process classification as inactive?   That would stop this process from being discovered I would think.