|
これならどうですか?
Excelファイル開いてAlt+F11でVBEの標準モジュールに貼り付けて、実行!
Sub win32compsys2()
Dim strComputer: Dim objWMIService
Dim colItems: Dim objItem
Dim msg As Variant
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
For Each objItem In colItems
msg = msg & Chr(10) & "Domain: " & objItem.Domain
msg = msg & Chr(10) & "Caption: " & objItem.Caption
msg = msg & Chr(10) & "NameFormat: " & objItem.NameFormat
msg = msg & Chr(10) & "Name: " & objItem.Name
msg = msg & Chr(10) & "UserName: " & objItem.USERNAME
msg = msg & Chr(10) & "PrimaryOwnerName: " & objItem.PrimaryOwnerName
msg = msg & Chr(10) & "Description: " & objItem.Description
msg = msg & Chr(10) & "Manufacturer: " & objItem.Manufacturer
msg = msg & Chr(10) & "Model: " & objItem.Model
msg = msg & Chr(10) & "SystemType: " & objItem.SystemType
Next
MsgBox msg
End Sub
|
|