VBScript Examples
'Get the set
Set objProcSet = objService.InstancesOf(strWBEMClass)
If blnErrorOccurred("Could not obtain " & _
strWBEMClass & " instance.") Then
Exit Sub
End If
If objProcSet.Count = 0 Then
Call WriteLine("No processor information is available.", objOutputFile)
Exit Sub
End If
Call WriteLine("Processor information for Machine " _
& strServer, objOutputFile)
Call WriteLine("", objOutputFile)
For Each objProc In objProcSet
Call WriteLine("Name = " & _
objProc.Name, objOutputFile)
Call WriteLine("Current Voltage = " & _
objProc.CurrentVoltage, objOutputFile)
Call WriteLine("Device ID = " & _
objProc.DeviceID, objOutputFile)
Call WriteLine("Status = " & _
objProc.CpuStatus, objOutputFile)
Call WriteLine("Data Width = " & _
objProc.DataWidth, objOutputFile)
Call WriteLine("Current Clock Speed = " & _
objProc.CurrentClockSpeed, objOutputFile)
Call WriteLine("L2 Cache Size = " & _
objProc.L2CacheSize, objOutputFile)
Call WriteLine("Level = " & _
objProc.Level, objOutputFile)
Call WriteLine("External Clock = " & _
objProc.ExtClock, objOutputFile)
Call WriteLine("", objOutputFile)
Next
ActiveXperts Network Monitor provides examples of WMI in VB.
To display properties of objProc objects in WBEMClass "Win32_Processor", run this from the Resource Kit:
Name = Intel Celeron processor
Current Voltage = 33
Device ID = CPU0
cpu Status = 1
Data Width = 32
Current Clock Speed = 499
L2 Cache Size = 128
Level = 6
Ext(ernal) Clock = 83
To display properties of objMBOI objects in WBEMClass "Win32_MotherboardDevice",
run this from the Resource Kit:
Name = Motherboard
Device ID = Motherboard
Primary Bus Type = PCI
Secondary Bus Type = ISA
To display properties of objCache objects in WBEMClass "Win32_CacheMemory",
the Size and Error Correction type used by your Cache,
run this from the Resource Kit:
Name = Cache Memory
Error Correct Type = Unknown
Location = Internal
Max Cache Size = 32
Name = Cache Memory
Error Correct Type = Unknown
Location = External
Max Cache Size = 2048
To display file extensions (shown in Windows Explorer Folder Options):
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
.386 vxdfile Virtual Device Driver
.3g2 QuickTime.3g2 3GPP2 Movie
...
|