访问SQL Server WMI对象
1. 使用Powershell访问
get-wmiobject -list -namespace "root\Microsoft\SqlServer"
get-wmiobject -list -namespace "root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER"
get-wmiobject -namespace "root\Microsoft\SqlServer\ComputerManagement10" -query "Select * From SqlService"
2. 使用wbemtest.exe访问
在开始、运行,输入wbemtest.exe
![](https://img.haomeiwen.com/i19037428/aa68c278991105c4.png)
输入空间名:
root\Microsoft\SqlServer\ComputerManagement10
![](https://img.haomeiwen.com/i19037428/91d82c66daaa9dce.png)
![](https://img.haomeiwen.com/i19037428/5a84f24220b2c50a.png)
![](https://img.haomeiwen.com/i19037428/56123dc9abdce68b.png)
遇到的问题:
在访问wbemtest.exe时,会遇到权限问题,如下:
![](https://img.haomeiwen.com/i19037428/c55ecaa652afa3b9.png)
在开始、运行,输入wmimgmt.msc
![](https://img.haomeiwen.com/i19037428/4fef2f95e4dc6fce.png)
右键WMI Control(local),点击Properties
![](https://img.haomeiwen.com/i19037428/8cc979dac5b5a66b.png)
切换到Security窗口,展开到需要访问的目录,授予DX\xucy访问权限。
网友评论