PR

VisualBasic WMIを使って得られる情報

WMIを使って得られる情報

スポンサードリンク

Dim strComputer = “.”
Dim wbemServices = GetObject(“winmgmts:\\” & strComputer)
Dim wbemObjectSet = wbemServices.InstancesOf(“Win32_ComputerSystem”)

For Each wbemObject In wbemObjectSet
Debug.Print(“Win32_ComputerSystem:”)
Debug.Print(”   Caption:           ” & wbemObject.Caption)
Debug.Print(”   Description:       ” & wbemObject.Description)
Debug.Print(”   Manufacturer:      ” & wbemObject.Manufacturer)
Debug.Print(”   Model:             ” & wbemObject.Model)
Debug.Print(”   Name:              ” & wbemObject.Name)
Debug.Print(”   OEMStringArray:    ” & wbemObject.OEMStringArray)
Debug.Print(”   SupportContactDescription: ” & wbemObject.SupportContactDescription)
Debug.Print(”   PrimaryOwnerName:  ” & wbemObject.PrimaryOwnerName)
Debug.Print(”   SystemType:        ” & wbemObject.SystemType)
Debug.Print(”   UserName:          ” & wbemObject.UserName)
Debug.Print(”   Workgroup:         ” & wbemObject.Workgroup)
Debug.Print(vbCr)
Next

wbemObjectSet = wbemServices.InstancesOf(“Win32_ComputerSystemProduct”)
For Each wbemObject In wbemObjectSet
Debug.Print(“Win32_ComputerSystemProduct:”)
Debug.Print(”   Caption:           ” & wbemObject.Caption)
Debug.Print(”   Description:       ” & wbemObject.Description)
Debug.Print(”   IdentifyingNumber: ” & wbemObject.IdentifyingNumber)
Debug.Print(”   Name:              ” & wbemObject.Name)
Debug.Print(”   SKUNumber:         ” & wbemObject.SKUNumber)
Debug.Print(”   UUID:              ” & wbemObject.UUID)
Debug.Print(”   Vendor:            ” & wbemObject.Vendor)
Debug.Print(vbCr)
Next

wbemObjectSet = wbemServices.InstancesOf(“Win32_OperatingSystem”)
For Each wbemObject In wbemObjectSet
Debug.Print(“Win32_OperatingSystem:”)
Debug.Print(”   Caption:           ” & wbemObject.Caption)
Debug.Print(”   Version:           ” & wbemObject.Version)
Debug.Print(”   RegisteredUser:    ” & wbemObject.RegisteredUser)
Debug.Print(”   Manufacturer:      ” & wbemObject.Manufacturer)
‘  Debug.Print(”   PAEEnabled:        ” & wbemObject.PAEEnabled)
Debug.Print(”   OtherTypeDescription: ” & wbemObject.OtherTypeDescription)
Debug.Print(”   OSLanguage:        ” & wbemObject.OSLanguage)
Debug.Print(”   Organization:      ” & wbemObject.Organization)
Debug.Print(”   NumberOfProcesses: ” & wbemObject.NumberOfProcesses)
Debug.Print(”   Name:              ” & wbemObject.Name)
Debug.Print(”   Manufacturer:      ” & wbemObject.Manufacturer)
Debug.Print(”   Locale:            ” & wbemObject.Locale)
Debug.Print(”   InstallDate:       ” & wbemObject.InstallDate)
Debug.Print(”   FreePhysicalMemory: ” & wbemObject.FreePhysicalMemory)
Debug.Print(”   FreeSpaceInPagingFiles: ” & wbemObject.FreeSpaceInPagingFiles)
Debug.Print(”   FreeVirtualMemory: ” & wbemObject.FreeVirtualMemory)
Debug.Print(”   Description:       ” & wbemObject.Description)
Debug.Print(”   CSName:            ” & wbemObject.CSName)
Debug.Print(”   CSDVersion:        ” & wbemObject.CSDVersion)
Debug.Print(”   BootDevice:        ” & wbemObject.BootDevice)
Debug.Print(”   BuildNumber:       ” & wbemObject.BuildNumber)
Debug.Print(”   BuildType:         ” & wbemObject.BuildType)
Debug.Print(”   CodeSet:           ” & wbemObject.CodeSet)
Debug.Print(”   CountryCode:       ” & wbemObject.CountryCode)
Debug.Print(”   CreationClassName: ” & wbemObject.CreationClassName)
Debug.Print(”   CSCreationClassName: ” & wbemObject.CSCreationClassName)
Debug.Print(”   LastBootUpTime:    ” & wbemObject.LastBootUpTime)
Debug.Print(”   RegisteredUser:    ” & wbemObject.RegisteredUser)
Debug.Print(”   SerialNumber:      ” & wbemObject.SerialNumber)
Debug.Print(”   ServicePackMajorVersion: ” & wbemObject.ServicePackMajorVersion)
Debug.Print(”   ServicePackMinorVersion: ” & wbemObject.ServicePackMinorVersion)
Debug.Print(”   SizeStoredInPagingFiles: ” & wbemObject.SizeStoredInPagingFiles)
Debug.Print(”   TotalSwapSpaceSize: ” & wbemObject.TotalSwapSpaceSize)
Debug.Print(”   TotalVirtualMemorySize: ” & wbemObject.TotalVirtualMemorySize)
Debug.Print(”   TotalVisibleMemorySize: ” & wbemObject.TotalVisibleMemorySize)
Debug.Print(”   WindowsDirectory:   ” & wbemObject.WindowsDirectory)
Debug.Print(”   SystemDirectory:    ” & wbemObject.SystemDirectory)
Debug.Print(”   SystemDevice:       ” & wbemObject.SystemDevice)
Debug.Print(vbCr)
Next

wbemObjectSet = wbemServices.InstancesOf(“Win32_Processor”)
For Each wbemObject In wbemObjectSet

Debug.Print(“Win32_Processor:”)
Debug.Print(”   Name:              ” & wbemObject.Name)
Debug.Print(”   AddressWidth:      ” & wbemObject.AddressWidth)
Debug.Print(”   DataWidth:         ” & wbemObject.DataWidth)
Debug.Print(”   Architecture:      ” & wbemObject.Architecture)
Debug.Print(”   Caption:           ” & wbemObject.Caption)
Debug.Print(”   MaxClockSpeed:     ” & wbemObject.MaxClockSpeed)
Debug.Print(”   CurrentClockSpeed: ” & wbemObject.CurrentClockSpeed)
Debug.Print(”   CurrentVoltage:    ” & wbemObject.CurrentVoltage)
Debug.Print(”   Description:       ” & wbemObject.Description)
Debug.Print(”   DeviceID:          ” & wbemObject.DeviceID)
Debug.Print(”   ExtClock:          ” & wbemObject.ExtClock)
Debug.Print(”   Family:            ” & wbemObject.Family)
Debug.Print(”   L2CacheSize:       ” & wbemObject.L2CacheSize)
Debug.Print(”   L2CacheSpeed:      ” & wbemObject.L2CacheSpeed)
Debug.Print(”   Level:             ” & wbemObject.Level)
Debug.Print(”   Manufacturer:      ” & wbemObject.Manufacturer)
Debug.Print(”   OtherFamilyDescription: ” & wbemObject.OtherFamilyDescription)
Debug.Print(”   ProcessorId:       ” & wbemObject.ProcessorId)
Debug.Print(”   ProcessorType:     ” & wbemObject.ProcessorType)
Debug.Print(”   Revision:          ” & wbemObject.Revision)
Debug.Print(”   SocketDesignation: ” & wbemObject.SocketDesignation)
Debug.Print(”   Status:            ” & wbemObject.Status)
Debug.Print(”   StatusInfo:        ” & wbemObject.StatusInfo)
Debug.Print(”   Stepping:          ” & wbemObject.Stepping)
Debug.Print(”   LoadPercentage:    ” & wbemObject.LoadPercentage)
Debug.Print(”   SystemName:        ” & wbemObject.SystemName)
Debug.Print(”   Version:           ” & wbemObject.Version)
Debug.Print(vbCr)
Next

結果(一部伏せ字)

Win32_ComputerSystem:
Caption:           ********
Description:       AT/AT COMPATIBLE
Manufacturer:      Supermicro
Model:             X6DAL
Name:              *******
OEMStringArray:
SupportContactDescription:
PrimaryOwnerName:  *****
SystemType:        X86-based PC
UserName:          ********\****
Workgroup:

Win32_ComputerSystemProduct:
Caption:           コンピュータ システム製品
Description:       コンピュータ システム製品
IdentifyingNumber: 1234567890
Name:              X6DAL
SKUNumber:
UUID:              41443658-004C-3000-4853-0*******
Vendor:            Supermicro

Win32_OperatingSystem:
Caption:           Microsoft Windows XP Professional
Version:           5.1.2600
RegisteredUser:    *******
Manufacturer:      Microsoft Corporation
OtherTypeDescription:
OSLanguage:        1041
Organization:
NumberOfProcesses: 80
Name:              Microsoft Windows XP Professional|C:\WINDOWS|\Device\Harddisk0\Partition1
Manufacturer:      Microsoft Corporation
Locale:            0411
InstallDate:       20080323064703.000000+540
FreePhysicalMemory: 1035076
FreeSpaceInPagingFiles: 3074692
FreeVirtualMemory: 2051032
Description:
CSName:            *******
CSDVersion:        Service Pack 3
BootDevice:        \Device\HarddiskVolume1
BuildNumber:       2600
BuildType:         Multiprocessor Free
CodeSet:           932
CountryCode:       81
CreationClassName: Win32_OperatingSystem
CSCreationClassName: Win32_ComputerSystem
LastBootUpTime:    20080612003750.109375+540
RegisteredUser:    *****
SerialNumber:      55383-640-0345286-*****
ServicePackMajorVersion: 3
ServicePackMinorVersion: 0
SizeStoredInPagingFiles: 4036828
TotalSwapSpaceSize:
TotalVirtualMemorySize: 2097024
TotalVisibleMemorySize: 2096400
WindowsDirectory:   C:\WINDOWS
SystemDirectory:    C:\WINDOWS\system32
SystemDevice:       \Device\HarddiskVolume1

Win32_Processor:
Name:                                Intel(R) Xeon(TM) CPU 3.20GHz
AddressWidth:      32
DataWidth:         32
Architecture:      0
Caption:           x86 Family 15 Model 4 Stepping 1
MaxClockSpeed:     2800
CurrentClockSpeed: 2800
CurrentVoltage:
Description:       x86 Family 15 Model 4 Stepping 1
DeviceID:          CPU0
ExtClock:          800
Family:            2
L2CacheSize:       0
L2CacheSpeed:
Level:             15
Manufacturer:      GenuineIntel
OtherFamilyDescription:
ProcessorId:       BFEBFBFF00000F4*
ProcessorType:     3
Revision:          1025
SocketDesignation: CPU 1
Status:            OK
StatusInfo:        3
Stepping:          1
LoadPercentage:    8
SystemName:        ********
Version:           モデル 4, ステッピング 1

Win32_Processor:
Name:                                Intel(R) Xeon(TM) CPU 3.20GHz
AddressWidth:      32
DataWidth:         32
Architecture:      0
Caption:           x86 Family 15 Model 4 Stepping 1
MaxClockSpeed:     2800
CurrentClockSpeed: 2800
CurrentVoltage:
Description:       x86 Family 15 Model 4 Stepping 1
DeviceID:          CPU1
ExtClock:          800
Family:            2
L2CacheSize:       0
L2CacheSpeed:
Level:             15
Manufacturer:      GenuineIntel
OtherFamilyDescription:
ProcessorId:       BFEBFBFF00000F4*
ProcessorType:     3
Revision:          1025
SocketDesignation: CPU 2
Status:            OK
StatusInfo:        3
Stepping:          1
LoadPercentage:    19
SystemName:        ********
Version:           モデル 4, ステッピング 1

参考文献

コメント