I'm using a ManagementObjectSearcher to query information about installed Sql Server instances, for example:
[String].Format("select * from SqlServiceAdvancedProperty
where SQLServiceType = 1 and PropertyName = '{0}'
and ServiceName = '{1}'", propertyName, serviceName)
This method works great for InstanceID, Version and SKUName but now I'm trying to find the installation root as well. For SQL 2005 it appears the property name was SqlDataRoot, but has since been depreciated.
Anybody know the correct property name to use to get the data directory, or even just install directory for Sql Server? Even just a list possible properties that can be queried would be an enormous help.
I looped over each property on a query (that didn't include a specified property) and was able to draw out each name. The property I was looking for is DATAPATH.
For anyone else whose interested, the other possibilities are:
SQLSTATES VERSION SPLEVEL CLUSTERED INSTALLPATH LANGUAGE DATAPATH FILEVERSION VSNAME REGROOT SKU SKUNAME INSTANCEID STARTUPPARAMETERS ERRORREPORTING DUMPDIR SQMREPORTING ISWOW64
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With