Use WBEMTEST to check for SQL Services on target system
Question
How can I use WBEMTEST to check the SQL Services present in the WMI Namespace for SQL Server?
Environment
Privileged Access Manager (PAM, self-hosted);Privilege Cloud Central Policy Manager (CPM)
Answer
-
Launch WBEMTEST.exe
-
Click Connect
-
In the Namespace field enter (replacing <targetserver fqdn> with the correct value):
\\<targetserver fqdn>\root\Microsoft\SqlServer
-
Enter the appropriate credentials in the Credentials box: (IE the Master Account creds, or the Logon Account creds if a logon account is defined)
User: <domain>\<account>
Password: <password>
-
Click "Connect"
-
Click "Query"
-
In the "Enter Query" field use:
SELECT * FROM __namespace WHERE Name LIKE "ComputerManagement%"
-
Click "Apply"
-
Make note of the value returned for __NAMESPACE.Name.
For example, "ComputerManagement12", or "ComputerManagement15"
-
Click Close
-
Click "Open Namespace"
-
In the Object Path field, enter the value from Step 9 (without quotes).
-
Click "OK"
-
Click "Query"
-
Use the following Query to return all SQL Services present in the WMI Namespace for SQLServer:
SELECT * from sqlservice
-
Check to see if there is a SqlService.ServiceName value that matches the desired Windows Service. An entry must be present for the desired SQL service for the Windows Service CPM Plugin to manage it.
The following table lists which namespace you should expect to see returned given the version of SQL Server installed:
| SQL Server version | $namespace |
| 2005 & earlier | root\Microsoft\SqlServer\ComputerManagement |
| 2008 | root\Microsoft\SqlServer\ComputerManagement10 |
| 2012 | root\Microsoft\SqlServer\ComputerManagement11 |
| 2014 | root\Microsoft\SqlServer\ComputerManagement12 |
| 2016 | root\Microsoft\SqlServer\ComputerManagement13 |
| 2017 | root\Microsoft\SqlServer\ComputerManagement14 |
| 2019 | root\Microsoft\SqlServer\ComputerManagement15 |
| 2022 | root\Microsoft\SqlServer\ComputerManagement16 |
Additional Information
Details
Q:- Launch WBEMTEST.exe
- Click Connect
- In the Namespace field enter: (replacing <targetserver fqdn> with the correct value)
\\<targetserver fqdn>\root\Microsoft\SqlServer - Enter the appropriate credentials in the Credentials box: (IE the Master Account creds, or the Logon Account creds if a logon account is defined)
User: <domain>\<account>
Password: <password> - Click "Connect"
- Click "Query"
- In the "Enter Query" field use:
SELECT * FROM __namespace WHERE Name LIKE "ComputerManagement%" - Click "Apply"
- Make note of the value returned for __NAMESPACE.Name.
__NAMESPACE.Name="ComputerManagement12" - Click Close
- Click "Open Namespace"
- In the Object Path field, enter the value from Step 9
ComputerManagement12 - Click "OK"
- Click "Query"
- Use the following Query to return all SQL Services present in the WMI Namespace for SQLServer
SELECT * from sqlservice - Check to see if there is a SqlService.ServiceName value that matches the desired Windows Service. An entry must be present for the desired SQL service for the Windows Service CPM Plugin to manage it.
IE.