我的csdn博客地址: http://blog.csdn.net/blizzardlyk

通过VBS 获取系统所有服务信息

上一篇 / 下一篇  2010-08-25 10:43:39 / 个人分类:QTP

通过访问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

 


TAG: vbs VBS 系统服务信息

 

评分:0

我来说两句

Open Toolbar