title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Use the WMI Provider for Configuration Management |
Learn about the WMI Provider for Configuration Management, including binding, specifying a connection string, and permissions/server authentication. |
markingmyname |
maghan |
04/12/2019 |
sql |
wmi |
reference |
|
[!INCLUDE SQL Server]
This article provides guidance about how to program with the WMI Provider for Computer Management.
The WMI Provider for Configuration Management is a COM object model and it supports early and late binding. With late binding you can use script languages, such as VBScript, to manipulate the [!INCLUDEssNoVersion] services, network settings, and aliases programmatically.
Applications direct the WMI Provider for Configuration Management to an instance of [!INCLUDEssNoVersion] by connecting to a WMI namespace defined by the provider. The Windows WMI service maps this namespace to the provider DLL, and loads the DLL into memory. All instances of [!INCLUDEssNoVersion] are represented with a single WMI namespace.
The namespace defaults to the following format. In the format, VV
is the major version number of SQL Server. The number is discoverable by running SELECT @@VERSION;
.
\\.\root\Microsoft\SqlServer\ComputerManagementVV
When you connect by using PowerShell, the leading \\.\
must be removed. For example, the following PowerShell code lists all WMI classes for a SQL Server 2016, which is major version 13.
Get-WmiObject -Namespace 'root\Microsoft\SqlServer\ComputerManagement13' -List
You can use following PowerShell code to query all available WMI ComputerManagement namespaces.
gwmi -ns 'root\Microsoft\SqlServer' __NAMESPACE | ? {$_.name -match 'ComputerManagement' } | select name
Note: If you are connecting through Windows Firewall you will need to make sure your computers are configured appropriately. See the "Connecting Through Windows Firewall" article in the Windows Management Instrumentation documentation on [!INCLUDEmsCoName] MSDN Web site.
To access the WMI Provider for Configuration Management, the client WMI management script must be running in the context of an administrator on the target computer. You need to be a member of the local Windows administrators group on the computer you want to manage.
The administrator can set group policies to control user access to WMI providers. For more information about setting group policies see "Group Policy and MMC" in the [!INCLUDEssNoVersion] Configuration Manager Help.
The WMI management script can be used to update the account under which [!INCLUDEssNoVersion] services run.
Security certificates are supported by the WMI Provider for Configuration Management. For more information about certificates, see Encryption Hierarchy.