[Asm] 纯文本查看 复制代码
ON ERROR RESUME NEXT
Temp = 0
Set WSHNetwork = WScript.CreateObject("WScript.Network")
T1:
UserName =InputBox("本工具用来收集终端硬件信息,不涉及任何个人及企业数据,请输入标签编号,计算机应以J开头的5位编码,打印机以D开头的5位编码", "请输入:")
if len(UserName)<>5 then WScript.Quit(0)
depatment =InputBox("请输入部门信息", "请输入:")
UserName1 =InputBox("请输入使用人的工号", "请输入:")
position =InputBox("请输入位于的楼号信息", "请输入:")
position1 =InputBox("请输入位于的楼层信息", "请输入:")
position2 =InputBox("请输入位于的房间信息", "请输入:")
TempFiles ="\\155.155.1.173\shares\zctj\"& UserName &".csv"
'网络路径请设置"\\155.155.1.173\shares\zctj\Local\"
printername =InputBox("请输入连接的打印机型号,多台打印机可用 | 分割,不能是逗号", "请输入:")
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")
Set TempFile = FSO.CreateTextFile(TempFiles)
strComputer = "."
Set objWMIService = Getobject("winmgmts:\\" & strComputer & "\root\cimv2")
Set CPU = objWMIService.ExecQuery("Select * From Win32_Processor")
For Each Item In CPU
CPU2 = Item.Name
Next
Set Board = objWMIService.ExecQuery("Select * From Win32_BaseBoard")
For Each Item In Board
Board2 = Item.Manufacturer
Board3 = Item.serialnumber
if Item.serialnumber="" then Board3 =InputBox("无法自动获得主机SN,请输入主机SN", "请输入:")
Next
Set colItems = objWMIService.ExecQuery("Select * From Win32_PhysicalMemory")
For Each objItem In colItems
A = objItem.Capacity/1073741824
Temp = temp+objItem.Capacity
N = N+1
Next
Memory = Temp/1073741824
Memory2 = Memory
Set Disk = objWMIService.ExecQuery("Select * From Win32_DiskDrive")
For Each Item In Disk
Disk2 = Disk2 & Item.Model & "("& Round(Item.Size/1000000000) & "G) "
Next
Disk3 = Trim(Disk2)
Function GetIPMAC(ComputerName)
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
GetIPMAC = objAddress & "," & objItem.MACAddress
Exit For
End If
Next
Exit For
Next
End Function
Set os = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each Item in os
os= Item.Caption
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
Video2 = "Video Card:" & Item.Description
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS", , 48)
For Each objItem In colItems
OpDate=objItem.ReleaseDate
OpDate1=left(OpDate,8)
Next
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
Model=objItem.Model
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS", , 48)
For Each objItem in colItems
SSN=objItem.SerialNumber
Next
leixin="台式机"
TempFile.WriteLine("编号,部门,用户,楼号,楼层,房间号,打印机,计算机名,操作系统,处理器,内存,磁盘,IP地址,MAC地址,显卡,制造厂商,序列号,型号,出厂日期,类型,采集时间")
TempFile.WriteLine(UserName&","&depatment&","&UserName1&","&position&","&position1&","&position2&","&printername&","&computername&","&os&","&CPU2&","&Memory2&","&Disk3&","&GetIPMAC(".")&","&Video2&video3&","&Board2&","&SSN&","&Model&","&OpDate1&","&leixin&","&now())
TempFile.Close
set ws=createobject("wscript.shell")
ws.run TempFiles,x,ture