新进化论

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

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


Set wshShell = Wscript.CreateObject( "Wscript.Shell" )
strServer=wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("software_list_" & strServer & ".txt", True)

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product")


For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.name & "," & _
objSoftware.Vendor & "," & _
objSoftware.Version
Next
objTextFile.Close

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