2018-01-24 10:31

 版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明,否则将追究法律责任。https://blog.kokojia.com/91xueit/b-878.html

双击保存的脚本,输入 部门  姓名 显示器信息,在vbs脚本文件夹下生成

电脑配置信息,打开如下图

1516760969623555.png

1516760942355543.png

实现方法:把以下脚本保存成《获取电脑配置信息.vbs》



ON ERROR RESUME Next

MsgBox"本脚本由韩老师提供,QQ:417357313,微信13073172070"   

MsgBox"本操作为采集公司办公设备,请大家积极配合," & Chr(13) & Chr(10) & "认真填写你所在部门和姓名," & Chr(13) & Chr(10) & "有问题请联系韩利辉,QQ:417357313,谢谢合作",vbYes, "计算机盘点系统"

   

Temp = 0

 Set WSHNetwork = WScript.CreateObject("WScript.Network")

 ComputerName = WSHNetwork.ComputerName

   

While Dept=""

 Dept=InputBox("请输入你所在的部门:","提示")

 Wend

   

While Name=""

 Name=InputBox("请输入你名字:","提示")

 Wend

 While Showq=""

 Showq=InputBox("请输入你电脑显示器的型号:" & Chr(13) & Chr(10) & "例:方正17纯平,方正17液晶 等","提示")

 Wend

   

TempFiles = ".\\" &Dept&"-"&Name& 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

 Next

   

Set Disk = objWMIService.ExecQuery("Select * From Win32_DiskDrive")

 For Each Item In Disk

 Disk2 = Disk2 & Item.Model & " "

 Next

 Disk3 = "硬盘: " & Trim(Disk2)

   

Set Network = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = true")

 For Each Item In Network

 Lan = "网卡: " & Item.Description

 Next

   

Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=true")

 For Each IPConfig in IPConfigSet

 If Not IsNull(IPConfig.IPAddress) Then

 For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)

 IP = IP & IPConfig.IPAddress(i) & " "

 Next

 End If

 Next

 IP = "IP: " & Trim(IP)

   

Set mc=GetObject("Winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

 For Each Item In mc

 If Item.IPEnabled=True Then

 Mac=Mac & Item.MacAddress & " "

 End If

 Next

 Mac = "MAC: " & Trim(Mac)

   

Name = "姓名: "&Name

 Dept = "部门: "&Dept

 Showq = "显示器: "&Showq

TempFile.WriteLine("==============请将以下信息全部复制粘贴=========")

 TempFile.WriteLine(Dept)

 TempFile.WriteLine(Name)

 TempFIle.WriteLine(Showq)

 TempFile.WriteLine(CPU2)

 TempFile.WriteLine(Board2)

 TempFile.WriteLine(Memory2)

 TempFile.WriteLine(Video2)

 TempFile.WriteLine(Disk3)

 TempFile.WriteLine(Lan)

 TempFile.WriteLine(IP)

 TempFile.WriteLine(mac)

TempFile.WriteLine("==============请将以上信息全部复制粘贴出来=========")

 TempFile.Close

 MsgBox "信息已经生成,请将文本内容,谢谢合作",vbYes,"公司"




 版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明,否则将追究法律责任。https://blog.kokojia.com/91xueit/b-878.html

评论