下面是我整合的VBS脚本,可以查机器硬件的信息,比较方便统计域内机器的情况。
问题是:现在运行只能跳出显示信息,那个命令可以将结果输出到文件TXT或Excel,特别是一个网络目录,根据机器的名字起文件名??拜托了~
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colSettings
Wscript.Echo "Service Pack: " & objOperatingSystem.ServicePackMajorVersion & "." & objOperatingSystem.ServicePackMinorVersion
Wscript.Echo "Windows Directory: " & objOperatingSystem.WindowsDirectory
Next
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
Wscript.Echo "System Name: " & objComputer.Name
Wscript.Echo "System Manufacturer: " & objComputer.Manufacturer
Wscript.Echo "System Model: " & objComputer.Model
Next
'CPU
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
Wscript.Echo "Ext Clock: " & objItem.ExtClock
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "Name: " & objItem.Name
Next
'diskspace
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For each objDisk in colDisks
Wscript.Echo "DeviceID: " & vbTab & objDisk.DeviceID
Wscript.Echo "FileSystem: " & vbTab & objDisk.FileSystem
Wscript.Echo "FreeSpace: " & vbTab & objDisk.FreeSpace /1024 /1024 /1024 & "G"
Wscript.Echo "Size: " & vbTab & objDisk.Size /1024 /1024 /1024 & "G"
Next
'Memory
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
Wscript.Echo "Capacity: " & objItem.Capacity /1024/1024 &"MB"
Next
'IE
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_BIOS")
For Each objBIOS in colSettings
Wscript.Echo "BIOS Version: " & objBIOS.Version
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2\Applications\MicrosoftIE")
Set colIESettings = objWMIService.ExecQuery _
("Select * from MicrosoftIE_Summary")
For Each strIESetting in colIESettings
Wscript.Echo "Language: " & strIESetting.Language
Wscript.Echo "Version: " & strIESetting.Version
Wscript.Echo "Path: " & strIESetting.Path
Wscript.Echo "Version: " & strIESetting.Version
Next