使用 ManagementObjectSearcher 获取 Sql Server 2008 的安装根目录的 SqlServiceAdvancedProperty 名称?
我正在使用 ManagementObjectSearcher 查询有关已安装的 Sql Server 实例的信息,例如:
[String].Format("select * from SqlServiceAdvancedProperty
where SQLServiceType = 1 and PropertyName = '{0}'
and ServiceName = '{1}'", propertyName, serviceName)
此方法非常适合 InstanceID、Version 和 SKUName,但现在我也尝试查找安装根目录。对于 SQL 2005,属性名称似乎是 SqlDataRoot,但此后已被弃用。
有人知道用于获取数据目录的正确属性名称,甚至只是 Sql Server 的安装目录吗?即使只是列出可以查询的可能属性也会有巨大的帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我循环查询查询中的每个属性(不包括指定的属性),并能够提取每个名称。我正在寻找的属性是 DATAPATH。
对于其他感兴趣的人,其他可能性是:
SQLSTATES
版本
声级
簇状
安装路径
语言
数据路径
文件版本
VS名称
重新root
存货单位
SKU名称
实例ID
启动参数
错误报告
转储目录
平方米报告
ISWOW64
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