VBS script-written Windows Hardware Detection tool sharing _vbs related software

Source: Internet
Author: User
Tags eval
Const myname = "Windows Hardware View tool (Beta)--by:rex.pack" If not LCase (Replace (Wscript.fullname, Wscript.path & "\", "") = "cscript.exe" Then Set ws = CreateObject ("Wscript.Shell") ws. Run "cmd/c mode con:cols=115 & Color 0A & Title" & MyName & "& CScript//nologo" "& WScript. ScriptFullName & "" "Wscript.Quit end If '----Initialize Set SD = CreateObject (" Scripting.Dictionary ") sd. CompareMode = vbTextCompare Set S = new Basestr Set PC = new Basepc Set WMI = GetObject ("Winmgmts:{impersonationlevel=impe Rsonate}!\\.\root\cimv2 ") Cmdarr = Split (" OS CPU Board Memory video Disk USB cachememory network BIOS Sound Battery Blebattery "&" S1 S2 S3 S4 ") with SD. Add "?", "Call Menu". Add "E", "Wscript.Quit" for I = 1 to 17. Add CStr (i), Cmdarr (i) Next. Add "A", "1-6". Add "B", "7-9". Add "C", "10-13".	Add "D", "14-17" End with Echo myname called menu call Main '----CO Sub Menu () echo [device list] "echo" common group A:1.os 2.CPU 3. Motherboard 4. Memory 5. Video card 6. Hard Drive"Echo" subgroup B:7.usb 8. Cache 9. Network card "echo" soy sauce Group C:10.bios 11. Sound card Battery (12. Internal 13. Portable) "echo" [Test CPU] "echo" test group d:14. Variable Power-square operation 15. Character overlap 16. Add calculation 17. Stack calculation "End Sub sub Main () Print" > ": Getnum = Trim (InPut) with SD If. Exists (getnum) Then If isnumeric (getnum) Then Echo Eval ("PC." &. Item (getnum)) Else Arrlu = Split (. Item (Getnum), "-") for L = Arrlu (0) to Arrlu (1) Echo Eval ("PC." &. Item (CSTR (L)) Next End If Else Echo "#不支持的命令" "End If" Err.Number = 0 Then Echo ">x":
	
	Err.Clear Call Main End Sub ' DDC Class basestr private STRs Private Sub class_initialize () STRs = "" End Sub Private Sub class_terminate () Call Cls End Sub Public sub-CLS () STRs = Empty End Sub Public Property Let I
	
	Val str) If left (str, 1) = "☆" Then str = str & String (+, "=") STRs = STRs & vbCrLf & Str End Property Public Default Property Get I () i = STRs Cls-End Class class Basepc Private DPS Private Sub Class_Initialize () DPS = the Sub Private Sub Class_Terminate () DPS = Empty End Sub Fun Ction S1 () S1 = "Variable power square operation" & DPS & "Million Times:" & RT ("TestVar = I ^ 2", DPS * 10000) End Function function S2 () S2 = "Character overlay" & DPS & "000 Times: & RT (" TestVar = TestVar & VbTab ", DPS * 1000) End Function Functio
		n S3 () S3 = "Additive calculation" & DPS & "Million Times:" & RT ("TestVar = + +", DPS * 10000) End Function function S4 () S4 = "Overlay calculation" & DPS & "Million Times:" & RT ("TestVar = TestVar + I", DPS * 10000) End Function Private Function RT (B 
		Yval mathexp, ByVal Num) Dim Nowtimer, Newtimer, TestVar nowtimer = Timer for I = 1 to Num ExeCute mathexp Next Newtimer = FormatNumber (timer-nowtimer) * 1000, 3, True, False) & "MS" RT = newtimer TestVar = Empty End function function BIOS () on the Error Resume Next s.i = "☆[bios]" s.i = "┏━━━━━━━━━━━━━┉" for each tempobj in WMI.I Nstancesof ("Win32_BIOS")
			with tempobj s.i = "Manufacturers:" &. Manufacturer S.I = "┇ Date:" &. ReleaseDate s.i = "┇oem version:" &. Version s.i = "┇bios Edition:" &. SMBIOSBIOSVersion s.i = "┇major version:" &. Smbiosmajorversion s.i = "┇ state:" &. Status End With Next s.i = "┗━━━━━━━━━━━━━┉" BIOS = S-End Function function OS () on Error Resume Next s.i = "☆[os]" S.I = "┏━━━━━━━━━━━━━┉" for all tempobj in WMI. InstancesOf ("Win32_OperatingSystem") with tempobj s.i = "Label:" &. Caption s.i = "┇CSDV:" &. CSDVersion s.i = "┇ version:" &. Version s.i = "┇ram recognition:" &. totalvisiblememorysize/1024 & "MB" S.I = "┇ram available:" &. freephysicalmemory/1024 & "MB" End with Next s.i = "┗━━━━━━━━━━━━━┉" OS = S-End Function function Board () on Error Resume Next s.i = "☆[motherboard]" S.I = "┏━━━━━━━━━━━━━┉" for each tempobj in WMI. InstancesOf ("Win32_baseboard") with tempobj s.i = "Label:" &. Caption s.i ="┇ Number:" &. Product s.i = "┇ serial number:" &. SerialNumber s.i = "┇ name:" &. Name s.i = "┇ version:" &. Version s.i = "┇ Manufacturer:" &. Manufacturer S.I = "┇ state:" &. Status End With Next s.i = "┗━━━━━━━━━━━━━┉" Board = S-End Function function CPU () on Error Resume Next s . I = "☆[cpu]" s.i = "┏━━━━━━━━━━━━━┉" for all tempobj in WMI. InstancesOf ("Win32_Processor") with tempobj MCS =. MaxClockSpeed CCS =.
					CurrentClockSpeed If MCS mod 2 = 1 Then MCS = CCS + 1 if CCS mod 2 = 1 Then CCS = CCS + 1 If CCS = MCS Then Set SRP = GetObject ("Winmgmts:{impersonationlevel=impersonate}!\\.\root\default:stdregprov") SRP. 
					GetDWORDValue &h80000002, "Hardware\description\system\centralprocessor\0", "~mhz", OC Set SRP = Nothing Else  OC = CCS End If if oc Mod 2 = 1 Then OC = OC + 1 FC = Oc-mcs If fc > +10 Then OCLC = "Super" If FC < -10 Then OCLC = "Drop" OCLC = OCLC & "Frequency ratio:" & FormatpercenT (Fc/mcs, True, true) s.i = "┣cpu name:" & Trim (. Name) s.i = "┇CPU Schema:" &. Description s.i = "┇ Manufacturer:" &. Manufacturer S.I = "┇ Socket Specification:" &. Socketdesignation s.i = "┇cpu quantity:" &. Cpustatus & "" & String (. Cpustatus, "※") s.i = "┇ Core quantity:" &. NumberOfCores & "" & String (. NumberOfCores, "s.i") = "┇ Number of Threads:" &. NumberOfLogicalProcessors & "" & String (. NumberOfLogicalProcessors, "≈") s.i = "┇ address bit width:" &. Addresswidth & "bit" S.I = "┇ data bit width:" &. DataWidth & "Bit" s.i = "┇cpu voltage:" &. CURRENTVOLTAGE/10 & "V" s.i = "┇ external frequency:" &. Extclock & "MHz" s.i = "┇ Current frequency:" & OC & "MHz," & OCLC s.i = "┇ Original frequency:" & MCS ; "MHz" s.i = "┇cpu occupancy%:" &. Loadpercentage & "%" End with Next s.i = "┗━━━━━━━━━━━━━┉" CPU = S-End Function Function cachememory () O n Error Resume Next s.i = "☆[cache memory]" S.I = "┏━━━━━━━━━━━━━┉" for EaCh Tempobj in WMI. InstancesOf ("Win32_CacheMemory") with Tempobj If. Maxcachesize > 0 Then Select case. Purpose case "L1 Cache" addstr = "(+databit)" Case Else end Select s.i = "┇ action bit:" &. Purpose & "ID:" &. DeviceID & ":" &. Maxcachesize & "KB" & addstr addstr = "" End If End with Next s.i = "┗━━━━━━━━━━━━━┉" Cachememor y = S End Function function Memory () on the Error Resume Next Temparr = Split ("Unknown other DRAM synchronous-dram Cach E-dram EDO edram VRAM SRAM RAM ROM Flash EEPROM feprom EPROM cdram 3DRAM SDRAM sgram RDRAM DDR DDR-2 ") s.i =" ☆[Memory] "S . I = "┏━━━━━━━━━━━━━┉" for each tempobj in WMI. InstancesOf ("Win32_physicalmemory") with tempobj s.i = "Name/Label:" &. Name & "/" &. Caption s.i = "┇BL:" &. Banklabel s.i = "┇ slot:" &. Devicelocator s.i = "┇ capacity:" &. capacity/1048576 & "MB" s.i = "┇ type:" & Temparr (. Memorytype) s.i = "┇ rate: "&. Speed & "MHz" s.i = "┇ Manufacturer:" &. Manufacturer S.I = "┇ Hot plug:" & IIf (. Hotswappable = True, True, False) s.i = "┇ Total bit width:" &. Totalwidth s.i = "┇ data bit width:" &. DataWidth s.i = "┇ part serial Number:" &. PartNumber End With Next s.i = "┗━━━━━━━━━━━━━┉" Memory = S-End Function function, () on Error Resume Ne XT TempArr1 = Split ("Other unknown CGA EGA VGA SVGA MDA HGC mcga 8514A XGA Linear Frame Buffer" & Space (160-14) & "PC -98 ") TempArr2 = Split (" Other unknown interlace line by row ") s.i =" ☆[video card] "s.i =" ┏━━━━━━━━━━━━━┉ "for each tempobj in WMI. InstancesOf ("Win32_VideoController") with tempobj s.i = "interface:" & TEMPARR1 (. videoarchitecture) s.i = "┇ name:" &. Name s.i = "┇ Label:" &. Caption s.i = "┇id:" &. DeviceID s.i = "┇gpu:" &. Videoprocessor s.i = "┇ Manufacturer:" &. Adaptercompatibility s.i = "┇ Physical Memory:" &. adapterram/1048576 & "MB" S.I = "┇ scan mode:" & IIf (. CurrentscanmoDe = False, False, TEMPARR2 (. Currentscanmode) s.i = "┇ Resolution:" &. Currenthorizontalresolution & "X" &. Currentverticalresolution s.i = "┇ color disk:" &. Currentbitsperpixel & "Bit" s.i = "┇ refresh rate:" &. Currentrefreshrate & "Hz" & "(" &. Minrefreshrate & "-" &. maxrefreshrate& ")" S.I = "┇ driver version:" &. DriverVersion End and Next s.i = "┗━━━━━━━━━━━━━┉" video = S-End Function function Disk () on Error Resume N Ext s.i = "☆[hard disk]" for each tempobj in WMI. InstancesOf ("Win32_DiskDrive") with tempobj s.i = "┏[disk:" &. Index & "]━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉" s.i = "┇ name:" &. Name s.i = "┇ Label:" &. Caption s.i = "┇ interface:" &. InterfaceType s.i = "┇ Manufacturer:" &. Manufacturer S.I = "┇ serial number:" &. SerialNumber s.i = "┇ Media Description:" &. Description & "&" ┇ Media type: "&. MediaType s.i = "┇ cylinder number:" &. Totalcylinders & "" & "┇ Head Number:" &.
			Totalheads	S.I = "┇ standard capacity:" & FormatNumber (. size/1000000000, 2, True) & "GB" & "" & "┇ actual capacity:" & FormatNumber (. size/1073741824, 2, True) & "GB" s.i = "┇ Number of partitions:" &. Partitions s.i = "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉" s.i = "┣[partition]┳━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━┉" S.I = "┇ cable Primer ┇ Primary Partition ┇ Capacity (GB) ┇ block (size x Quantity) ┇ property "s.i =" ┣━━━╋━━━╋━━━━━━━╋━━━━━━━━━━━╋━━━━━┉ "for each TempObj0 in WMI. InstancesOf ("Win32_DiskPartition") If. Index = tempobj0.diskindex Then s.i = "┇" & Tempobj0.index & _ "┇" & Tempobj0.primarypartition & Amp _ "┇" & FormatNumber (tempobj0.size/1073741824, 2, True) & "GB" & _ "┇" & Tempobj0.blocksiz
						E & "x" & Tempobj0.numberofblocks & _ "┇" & _ TIf (tempobj0.bootpartition, "Boot,") & _
					TIf (Tempobj0.hiddensectors, "hidden,") & _ TIf (Tempobj0.bootable, "start.") End If Next s.i = "┣━━━┻━━━┻━━━━━━━┻━━━━━━━━━━━┻━━━━━┉" S.I = "┣[sector]━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉ "S.I = ┇ track sector:" &. Sectorspertrack s.i = "┇ sector size:" &. BytesPerSector s.i = "┇ total number of sectors:" &. Totalsectors s.i = "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉" End with Next Temparr = Split ("Unknown removable disk local Disk network drive Disc RAM Disk ") S.I =" ┏[partition information]━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉ "for each TempObj1 in CreateObject (" Scripting.filesystemobje CT "). Drives with TempObj1 If. IsReady Then PTS = Int (. FreeSpace/. TotalSize * s.i = "┇ Letter:" &. DriveLetter & "File system:" &. FileSystem & "Type:" & Temparr (. DriveType) & "volume Label:" &. 
				VolumeName s.i = "┇" & "Idle rate:" & PTS & "%" & String ((100-pts)/5, "") & String (PTS/5, "-") Else s.i = "┇ Letter:" &.
					DriveLetter & "Disk not ready!" S.I = "┇" & "Idle rate: 0%" & "≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡" End If End with Next s.i = "┗━━━━━━━━━━━━━━━━━━━━━━━━━━
		━━━━━━━┉ "Disk = S End Function function Sound () on Error Resume NextS.I = "☆[sound card]" S.I = "┏━━━━━━━━━━━━━┉" for each tempobj in WMI. InstancesOf ("Win32_sounddevice") with tempobj s.i = "Name/Label:" &. Name & "/" &. Caption s.i = "┇id:" &. DeviceID s.i = "┇ Manufacturer:" &. Manufacturer End With Next s.i = "┗━━━━━━━━━━━━━┉" Sound = S-End Function Function-Network () on Error resum E Next s.i = "☆[nic]" s.i = "┏━━━━━━━━━━━━━┉" for each tempobj in WMI. ExecQuery ("select * from Win32_NetworkAdapter Where physicaladapter = ' True '") with tempobj s.i = "┣[network card:" & Spa CE (3-len (. Index) &. Index & "]━━━━━━━━┉" s.i = "┇ tag:" &. Caption s.i = "┇pnpdid:" &. Pnpdeviceid s.i = "┇ Manufacturer:" &. Manufacturer S.I = "┇ rate:" & IIf (TypeName (. Speed) = "Null", False,. speed/10000 & "bps") s.i = "┇ Enabled:" &. netenabled s.i = "┇ Service Name:" &. ServiceName End With Next s.i = "┗━━━━━━━━━━━━━┉" network = S-End Function Function-Battery () on Error resu
	Me Next	TEMPARR1 = Split ("Discharge AC full low critical charge > High charge > Low charge > Critical undefined partial charge") TEMPARR2 = Split ("Other unknown lead-acid cadmium nickel nickel metal hydride lithium-ion zinc air Lithium polymer ") s.i =" ☆[internal battery] "S.I =" ┏━━━━━━━━━━━━━┉ "for each tempobj in WMI. InstancesOf ("Win32_Battery") with tempobj s.i = "Name/Label:" &. Name & "/" &. Caption s.i = "┇id:" &. DeviceID s.i = "┇pnpdid:" &. Pnpdeviceid s.i = "┇ charge time:" &. Batteryrechargetime s.i = "┇ State:" & TEMPARR1 (. Batterystatus) s.i = "┇ material:" & TEMPARR2 (. Chemistry) End With Next s.i = "┗━━━━━━━━━━━━━┉" Battery = S-End Function function Portablebattery () on ERR or Resume Next TempArr1 = Split ("Other unknown filled low critical charge > High charge > Low charge > Critical undefined part charge") TEMPARR2 = Split ("Other unknown lead acid cadmium nickel Nickel metal hydride lithium-ion zinc air lithium polymer "S.I =" ☆[Portable battery] "S.I =" ┏━━━━━━━━━━━━━┉ "for each tempobj in WMI. InstancesOf ("Win32_PortableBattery") with tempobj s.i = "Name/Label:" &. Name & "/" &. Caption s.i = "┇id:" &.
			DeviceID	S.I = "┇pnpdid:" &. Pnpdeviceid s.i = "┇ Manufacturer:" &. Manufacturer S.I = "┇ expected remaining:" &. Estimatedchargeremaining s.i = "┇ Estimated time:" &. EstimatedRunTime s.i = "┇ Power Management:" &. powermanagementsupported s.i = "┇ position:" &. Location s.i = "┇ Smart battery:" &. Smartbatteryversion s.i = "┇ material:" & TEMPARR2 (. Chemistry) End With Next s.i = "┗━━━━━━━━━━━━━┉" portablebattery = S-End Function function USB () on Error R Esume Next s.i = "☆[usb Dock]" s.i = "┏━━━━━━━━━━━━━┉" for each tempobj in WMI. InstancesOf ("Win32_usbcontroller") with tempobj s.i = "Label:" &. Caption s.i = "┇id:" &. DeviceID s.i = "┇pnpdid:" &. Pnpdeviceid s.i = "┇ Manufacturer:" &.  Manufacturer End and Next s.i = "┗━━━━━━━━━━━━━┉" USB = S end Function end Class '----' Output Sub Print (ByVal Texts) WScript.StdOut.Write texts End Sub sub-Echo (ByVal geom_tempdata) WScript.Echo Geom_tempdata End Sub ' output: Overwrite Gaixing, blank length Sub printc (byvAl texts, ByVal lennum) WScript.StdOut.Write Chr (& Texts & String (Lennum, "") end Sub ' output, + newline Sub prin TL (ByVal texts) WScript.StdOut.WriteLine (texts) End Sub ' input Function input () input = WScript.StdIn.ReadLine End function function iif (ByVal GEOM_TF, ByVal geom_t, ByVal geom_f) If GEOM_TF = True Then iif = geom_t Else iif = Geom_f E nd Function ' iif true Function TIf (ByVal geom_tf, ByVal geom_t) If GEOM_TF = True Then TIf = geom_t End Function ' IIf fake Func

 tion FIf (ByVal geom_tf, ByVal geom_f) If GEOM_TF = False Then FIf = Geom_f End Function

Operation Effect:

Related Article

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.