vbs-Computer hardware Information Viewer-source code-.exe program-can be used directly using replication

Source: Internet
Author: User

vbs-Computer hardware Information Viewer-source code-can be used directly using replication

#----------------------------------------------------------------------------------------Below is the source code

msgbox  "                Loading native configuration information, press OK to continue!        ", 40, " configuration information query "On error resume  Next  SerVerPath =  "c \ Hardware Information"    "the Save path here can be a UNC network path (\\path\)   set  wshshell=wscript.createobject ("Wscript.Shell")    ' start WMI service   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  wshshell.run  ("%comspec% /c if  not exist c:\ Hardware Information  mkdir c:\ hardware Information "),0,true   ' 2,5-10 behavior alone waits to be added, in 15 rows. \ The hardware information is the path in the above variables, which you can modify as needed.   dim objwmiservice  set objwmiservice = getobject ("winmgmts:\\.\root\ Cimv2 ")   dim objosinfos, objosinfo, osinfo, computername, osver  set  Objosinfos = objwmiservice.execquery ("Select * from win32_operatingsystem")    For Each objOSInfo In objOSInfos    OSInfo =  objosinfo.csname &  ","     ComputerName = objOSInfo.CSName     OSVer = objOSInfo.Version    OSInfo = OSInfo  & objOSInfo.Caption &  " "  & objOSInfo.CSDVersion &  ","     OSInfo  =  "System Information:"  & osinfo & mid (CSTR ( objosinfo.installdate), 1,4)  &  "-"  & _               mid (CStr (objosinfo.installdate), 5,2)  &  "-"  &  _      &Nbsp;       mid (CStr (objosinfo.installdate), 7,2)  &  "☆"    next  dim objboards, objboard, boardinfo  set objboards =  objwmiservice.execquery ("Select * from win32_baseboard")   For each  Objboard in objboards    boardinfo = trim (objBoard.Product)  &   ","     BoardInfo =  "motherboard model:"  & boardinfo & trim ( Objboard.manufacturer)  &  "☆"   Next  Dim objCPUs, objCPU,  Cpuinfo  set objcpus = objwmiservice.execquery ("Select * from win32_ Processor ")   for each objcpu in objcpus    cpuinfo =  trim (Objcpu.name)  &  ","     CPUInfo = CPUInfo &  objcpu.extclock &  ","     CPUInfo = CPUInfo & objCPU.L2CacheSize &   ","     CPUInfo =  "CPU Model:"  & CPUInfo &  objcpu.socketdesignation &  "☆"   next  dim objmemorys, objmemory,  memoryinfo  set objmemorys = objwmiservice.execquery ("Select * From  win32_physicalmemory ")   redim arrmemory (1)   For Each objMemory  In objmemorys    arrmemory (0)  = arrmemory (0)  + objmemory.capacity /1048576    arrmemory (1)  = arrmemory (1)  & objMemory.Speed  &  "/"  & objMemory.DeviceLocator &  " "   Next   memoryinfo =  "Memory Capacity:"  & objMemorys.Count  &  "bar, Total"  &  Arrmemory (0)  &  "M," & arrmemory (1)  & " ☆ "  dim objdisks, objdisk, diskinfo   set objdisks = objwmiservice.execquery ("Select * from win32_ DiskDrive ")   for each objdisk in objdisks    diskinfo =   "HDD Capacity:"  & trim (Objdisk.model)  &  "☆"     exit for   next  dim objvideos, objvideo, videoinfo  set objvideos  = objwmiservice.execquery ("Select * from win32_videocontroller")   For  each objvideo in objvideos    if not isnull ( Objvideo.videomodedescription)  Then        VideoInfo =  Trim (objvideo.description)         VideoInfo =  "graphics model:"   & VideoInfo &  "(" &NBSP;&Amp; objvideo.adapterram/1048576 &  "M) ☆"     end if  next   dim objnetworks, objnetwork, objnetworks_2, objnetwork_2, networkinfo   NetWorkInfo =  ""   set objnetworks = objwmiservice.execquery (" Select * from win32_networkadapter ")   Set objNetworks_2 =  objWMIService.ExecQuery ("Select * from win32_networkadapterconfiguration")   For  each objnetwork in objnetworks    if objnetwork.manufacturer < >  "Microsoft"  and not isnull (objnetwork.macaddress)  Then       For Each objNetwork_2 In objNetworks_2         If objNetwork_2.Index = objNetwork.Index Then           networkinfo =  "NIC info:"  & objNetwork.Description &  ","  & objnetwork_ 2.IPAddress (0)  & _                         space (17-len (objNetwork_2.IPAddress (0)))  & _                         replace (Objnetwork_2.macaddress, ":", "-")  &   "☆"           Exit For         End If      Next       If NetWorkInfo <>  ""  Then Exit For    End  if  next   ' Output information to file   dim fso, outfile  set fso =  wscript.createobject ("ScriptIng. FileSystemObject ")   serverpath = fso. Getabsolutepathname (Serverpath)   set outfile = fso. CreateTextFile (serverpath &  "\"  & ComputerName &  ". txt", True)     ' outfile.writeline osinfo & boardinfo & cpuinfo &  memoryinfo & diskinfo & videoinfo & networkinfo   ' The following information is made easy to view by waiting alone to overwrite the output above.   OutFile.Writeline OSInfo + vbCrLf  OutFile.Writeline BoardInfo   + vbCrLf  OutFile.Writeline CPUInfo  + vbCrLf   outfile.writeline memoryinfo  + vbcrlf  outfile.writeline diskinfo   + vbCrLf  OutFile.Writeline VideoInfo  + vbCrLf   outfile.writeline networkinfo + vbcrlf  msgbox  " " & OSInfo & "   "&vbNewLine& "   "& BoardInfo &"   " &vbNewLine& " " " & CPUInfo & " "  &vbNewLine&  " " & memoryinfo  & " "  &vbNewLine&  " " & DiskInfo & " "  & vbnewline&  " " & VideoInfo & " "  &vbNewLine&  " " &  NetWorkInfo          & "",  40,   "Configuration information Query"   set ws = createobject ("Wscript.Shell")   ws.run  "cmd  /c rd /s /q c:\ hardware Information ", vbhide

#----------------------------------------------------------------------------------------above as source code

This article is from the "Huangbaoliang" blog, make sure to keep this source http://hblbk.blog.51cto.com/7645149/1737605

vbs-Computer hardware Information Viewer-source code-.exe program-can be used directly using replication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.