- 帖子
- 6
- 积分
- 19
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2016-3-31
|
On Error Resume Next
Temp = 0
Set WSHNetwork = WScript.CreateObject("WScript.Network")
ComputerName = WSHNetwork.ComputerName
TempFiles = desktop & ComputerName &".txt"
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 = "CPU:" & Item.Name
Next
Set Board = objWMIService.ExecQuery("Select * From Win32_BaseBoard")
For Each Item In Board
Board2 = "主板: " & Item.Product
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
Set Video = objWMIService.ExecQuery("Select * From Win32_VideoController",,48)
For Each Item In Video
Video2 = "显卡: " & Item.Description
Video3 = "分辨率: " & Item.VideoModeDescription
Next
Set VideoA = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor",,48)
For Each Item In VideoA
VideoA = "显示器名称: " & Item.Description
VideoB = "屏幕高度: " & Item.ScreenHeight & " 屏幕宽度: " & Item.ScreenWidth
Next
Set Disk = objWMIService.ExecQuery("Select * From Win32_DiskDrive")
For Each Item In Disk
Disk2 = Disk2 & Item.Model
Disk4 = Int(Item.Size/1000/1000/1000) & "G"
Next
Disk3 = "硬盘: " & Trim(Disk2)
Disk5 = "硬盘容量: " & Disk4
Set Network = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each Item In Network
Lan = "网卡: " & Item.Description
IP = "IP地址: " & Item.IPAddress(0)
MacAdd = "MAC地址:" & Item.MACAddress
Next
TempFile.WriteLine(CPU2)
TempFile.WriteLine(Board2)
TempFile.WriteLine(Memory2)
TempFile.WriteLine(Video2)
TempFile.WriteLine(Video3)
TempFile.WriteLine(VideoA)
TempFile.WriteLine(VideoB)
TempFile.WriteLine(Disk3)
TempFile.WriteLine(Disk5)
TempFile.WriteLine(Lan)
TempFile.WriteLine(Ip)
TempFile.WriteLine(MacAdd)
TempFile.Close
运行此VBS后弹出输入ComputerName ,再以ComputerName保存配置文件,并复制一份至共享盘\\192.168.8.30\XINXIBU 谢谢! |
|