通过访问WMI 可以获取系统的所有后台服务信息
以下代码获取Win32_Service信息,并显示在一个Excel窗口中:
Set excel = CreateObject( "Excel.Application" )
With excel
.Visible = True
.Workbooks.Add
End With
x = 1
Set wmiService = GetObject( "winmgmts:root/cimv2" )
Set colServices = wmiService.ExecQuery( "Select * From Win32_Service" )
For Each service in colServices
excel.Cells( x, 1 ) = service.Name
excel.Cells( x, 2 ) = service.State
x = x + 1
Next
Set colServices = nothing
Set wmiService = nothing
Set excel = nothing
本文介绍了一种使用WMI获取Windows系统后台服务信息的方法,并将这些信息展示在一个Excel窗口中。通过VBA代码实现Win32_Service信息的抓取与展示。
202

被折叠的 条评论
为什么被折叠?



