新进化论

道生一,一生二,二生三,三生万物。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

strComputer = "."
Set wshShell = Wscript.CreateObject( "Wscript.Shell" )
strServer=wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%")
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.CreateTextFile("service_list_" & strserver & ".txt", True)

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Service ")

For Each objItem in colItems
Wscript.Echo objItem.displayName & "," & objItem.Startmode & "," & objItem.startname
file.WriteLine objItem.displayName & "," & objItem.Startmode & "," & objItem.startname
Next

posted on 2013-01-24 14:45  岌岌可危  阅读(208)  评论(0编辑  收藏  举报