1.在服务器上共享一个目录。设置好权限。比如: \\192.168.0.251\sysinfo%\
2.客户机器启动时自动运行一个VBS收集硬件信息。并存入上面的目录。
下面是VBS代码。。。来自网盟
=================================
On Error Resume Next
temp=0
set wshshell=wscript.createObject("wscript.shell")
'启动WMI服务(没有这个服务就不行)
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
Function GetIP(ComputerName) '取本机IP
Dim objWMIService,colItems,objItem,objAddress
Set objWMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objItem in colItems
For Each objAddress in objItem.IPAddress
If objAddress <> "" then
getip = objAddress
Exit For
End If
Next
Next
End Function
ipaddress=getip(".")
set fso=createObject("scripting.filesystemObject")
tempfilter="\\192.168.0.251\sysinfo$\"& 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=board2&"" & item.Product
next
'CPU
set cpu =objwmiservice.execQuery("select * from win32_processor")
for each item in cpu
cpu2= cpu2&"" & item.Name
next
'内存
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
a=objitem.capacity
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
'硬盘
set disk =objwmiservice.execQuery("select * from win32_diskdrive")
for each item in disk
disk2= disk2&"" & item.Model&" "
next
'显卡
set video =objwmiservice.execQuery("select * from win32_videocontroller",,48)
for each item in video
video2= video2&"" & item.Description
next
'网卡
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48)
For Each objItem in colItems
if (left(objItem.NetConnectionID,4)="本地连接") then
lanname=lanname&objItem.Name
end if
Next
lan2="网卡: " & lanname
tempfile.writeline(computername)
tempfile.writeline(ipaddress)
tempfile.writeline(board2)
tempfile.writeline(cpu2)
tempfile.writeline(memory2)
tempfile.writeline(disk2)
tempfile.writeline(video2)
'tempfile.writeline(lan2)
set WshShell = nothing
WScript.quit
=================================
加粗部分自己修改。。。
3.ASP收集处理TXT文件信息并显示
下面是text.asp代码,必须右键另存为。
=================================
下载文件 (已下载 165 次)
点击这里下载文件
=================================
加粗部分自己修改