On Error Resume Next
temp=0
set wshshell=wscript.createobject("wscript.shell")
wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,True
wshshell.run ("%comspec% /c sc config winmgmt start= auto"),0,True
wshshell.run ("%comspec% /c net start winmgmt"),0
Set WshNetwork = WScript.Createobject("WScript.Network")
computername=WshNetwork.ComputerName
set fso=createobject("scripting.filesystemobject")
tempfilter="//192.169.0.6/hard_info/"& computername &".txt"
set tempfile=fso.createtextfile(tempfilter)
strComputer = "."
Set objWMIService = Getobject("winmgmts://" & strComputer & "/root/cimv2")
set board =objwmiservice.execQuery("select * from win32_baseboard")
for each item in board
board2= item.Product
next
'CPU
set cpu =objwmiservice.execQuery("select * from win32_processor")
for each item in cpu
cpu2= item.Name
next
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
a=objitem.capacity/1048576
temp=temp+objitem.capacity
n=n+1
Next
memory=temp/1048576
if n=1 then
memory2= n & "条" &a& "M"
else
memory2= n & "条" &a& "M"&" 总"&memory&"M"
end if
'sound
set sound =objwmiservice.execQuery("select * from win32_SoundDevice",,48)
for each item in sound
sound2= item.ProductName
next
'OS
set OS =objwmiservice.execQuery("select * from win32_OperatingSystem",,48)
for each item in OS
OS2= item.Caption & item.Version
next
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then CDROM2 = (Trim(objItem.Name)) Else CDROM3 = (Trim(objItem.Name))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then lan1= (Trim(objItem.ProductName)) Else lan2= (Trim(objItem.ProductName))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then lan3= (Trim(objItem.MACAddress)) Else lan4= (Trim(objItem.MACAddress))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then disk2= (Trim(objItem.Caption)) Else disk3= ( Trim(objItem.Caption))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then video2 = (Trim(objItem.Caption) & (objItem.VideoModeDescription)) Else video3 = (Trim(objItem.Caption) & (objItem.VideoModeDescription))
J = J + 1
Next
set colItems =objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPConfig IN colItems
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
lan5= (IPConfig.IPAddress(i))
Next
End If
Next
tempfile.writeline(lan1)
tempfile.writeline(lan3)
tempfile.writeline(lan5)
tempfile.writeline(board2)
tempfile.writeline(cpu2)
tempfile.writeline(memory2)
tempfile.writeline(disk2)
tempfile.writeline(video2)
tempfile.writeline(sound2)
tempfile.writeline(OS2)
tempfile.writeline(CDROM2)
tempfile.writeline(lan2)
tempfile.writeline(lan4)
tempfile.writeline(disk3)
tempfile.writeline(video3)
tempfile.writeline(CDROM3)