I got some path while working on a project but not able to figure out the kind of it. What is this and how can I access it. if you know please share...
const string WmiNamespace_2005 = @"\\.\root\Microsoft\SqlServer\ReportServer\v9\Admin";
const string WmiRSClass_2005 = @"\\.\root\Microsoft\SqlServer\ReportServer\v9\Admin:MSReportServer_ConfigurationSetting";
const string WmiNamespace_2008 = @"\\.\root\Microso开发者_StackOverflow中文版ft\SqlServer\ReportServer\{0}\v10\Admin";
const string WmiRSClass_2008 = @"\\.\root\Microsoft\SqlServer\ReportServer\{0}\v10\Admin:MSReportServer_ConfigurationSetting";
const string WmiNamespaceToUse = "root\\Microsoft\\SqlServer\\ReportServer";
It is used for finding out the installed instances of SQL Server, but I am confused in these paths only..
This is a WMI Object Path.
Conceptually similar to a Uniform Resource Locator (URL), a WMI object path is a string that uniquely identifies the namespace on a server, a class within a namespace, or instances of a class. An object path is hierarchical, and contains several elements that describe the location of the object in question. Like file paths, WMI object paths can be described in full or specified as a relative path
EDIT: WMI Object Path Requirements
From MSDN:
An object path can use the following syntax:
- Strings contained in single quotation marks.
- Forward slashes as separators.
- Backslashes as separators.
- Hexadecimal constants for integers.
- Boolean constants for classes with keys that take Boolean values.
- URL notation to represent nonprinting characters, such as %20 for a blank space.
In addition, an object path string must obey the following restrictions:
- An assumed local server with a partial namespace path. Thus, specifying the root and default namespace implies the root and default namespace on the local server.
- No white space either within an element or between elements.
- Embedded quotation marks in object paths are allowed but must delimit the quotation mark with escape characters, as in a C or C++ application.
- Only decimal values are recognized as numeric portions of keys.
These are Windows Management Instrumentation paths. WMI provides a general API for management (in this case SQL Server). You address the management objects by namespaces that are similar to file system paths except they don't point to files but to management objects that can be queried and used to control whatever they are managing.
Have a look on this MSDN pages..
http://msdn.microsoft.com/en-us/library/aa390350(v=VS.85).aspx
These are used to access WMI information...
Some general links about WMI:
- http://geekswithblogs.net/PsychoCoder/archive/2008/01/25/using_wmi_in_csharp.aspx
- http://msdn.microsoft.com/en-us/library/bb404655.aspx
- http://msdn.microsoft.com/en-us/magazine/cc302051.aspx
Specific MSDN links about WMI SQL Server:
- SQL Server 2005
- SQL Server 2008
- SQL Server 2008 R2
精彩评论