Sei sulla pagina 1di 3

Sub summary

On Error Resume Next


Set colItems = objWMIService.ExecQuery _
("Select Name from Win32_ComputerSystem") 'Get Computer Name
For each objItem in colItems
strComputer = objItem.name 'Get Computer Name
Next
Row = 1
Col = 1
XL.Sheets.Add.name = ucase(strComputer) & "Summary"
XL.Cells(Row,Col).Value = "SerialNumber" : Col = Col + 1
XL.Cells(Row,Col).Value = "AdapterDescription" : Col = Col + 1
XL.Cells(Row,Col).Value = "DNSDomain" : Col = Col + 1
XL.Cells(Row,Col).Value = "IPAddress" : Col = Col + 1
XL.Cells(Row,Col).Value = "Description" : Col = Col + 1
XL.Cells(Row,Col).Value = "Caption" : Col = Col + 1
XL.Cells(Row,Col).Value = "CSDVersion" : Col = Col + 1
XL.Cells(Row,Col).Value = "Manufacturer" : Col = Col + 1
XL.Cells(Row,Col).Value = "ClockSpeed" : Col = Col + 1
XL.Cells(Row,Col).Value = "Processor" : Col = Col + 1
XL.Cells(Row,Col).Value = "System" : Col = Col + 1
XL.Cells(Row,Col).Value = "Vendor" : Col = Col + 1
XL.Cells(Row,Col).Value = "NumberOfProcessors" : Col = Col + 1
XL.Cells(Row,Col).Value = "TotalPhysicalMemory MB" : Col = Col + 1
XL.Cells(Row,Col).Value = "Disk Space GB" : Col = Col + 1
XL.Cells(Row,Col).Value = "MediaType" : Col = Col + 1
XL.Cells(Row,Col).Value = "Model" : Col = Col + 1
Row = Row + 1
Col = 1
Set colItems = nothing
Set colItems = objWMIService.ExecQuery _
("Select SerialNumber from Win32_BIOS")
For Each objItem in colItems
XL.Cells(Row,Col).Value = objItem.SerialNumber : Row = Row + 1
Next
Set colItems = nothing
Col = Col + 1
Row = 2
Set colItems = nothing
Set colItems = objWMIService.ExecQuery("Select Description, " _
& "DNSDomain, IPAddress from Win32_NetworkAdapterConfiguration")
For Each objItem in colItems
If Not IsNull(objItem.IPAddress) Then
XL.Cells(Row,Col).Value = objItem.Description : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.DNSDomain : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.IPAddress : Row = Row + 1 : Col = Col - 2
End If
Next
Col = Col + 3
Row = 2
Set colItems = nothing
Set colItems = objWMIService.ExecQuery _
("Select Caption, Description, CSDVersion from Win32_OperatingSystem")
For Each objItem in colItems
XL.Cells(Row,Col).Value = objItem.Description : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.Caption : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.CSDVersion : Row = Row + 1 : Col = Col - 2
Next
Col = Col + 3
Row = 2
Set colItems = nothing
Set colItems = objWMIService.ExecQuery _
("Select Manufacturer, CurrentClockSpeed, Name from Win32_Processor")
For Each objItem in colItems
XL.Cells(Row,Col).Value = objItem.Manufacturer : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.CurrentClockSpeed : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.Name : Row = Row + 1 : Col = Col - 2
Next
Col = Col + 3
Row = 2
Set colItems = nothing
Set colItems = objWMIService.ExecQuery _
("Select Name, Vendor from Win32_ComputerSystemProduct")
For Each objItem in colItems
XL.Cells(Row,Col).Value = objItem.Name : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.Vendor : Row = Row + 1 : Col = Col - 1
Next
Col = Col + 2
Row = 2
Set colItems = nothing
Set colItems = objWMIService.ExecQuery("Select NumberOfProcessors, " _
& "TotalPhysicalMemory from Win32_ComputerSystem")
For Each objItem in colItems
XL.Cells(Row,Col).Value = objItem.NumberOfProcessors : Col = Col + 1
XL.Cells(Row,Col).Value =
Round(objItem.TotalPhysicalMemory / (1024*1024),0) : Row = _
Row + 1 : Col = Col - 1
Next
Col = Col + 2
Row = 2
Set colItems = objWMIService.ExecQuery _
("Select size, MediaType, Model from Win32_DiskDrive")
For Each objItem in colItems
XL.Cells(Row,Col).Value = objItem.Size / (1024*1024*1024) : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.MediaType : Col = Col + 1
XL.Cells(Row,Col).Value = objItem.Model : Row = Row + 1 : Col = Col - 2
Next
XL.Cells.EntireColumn.AutoFit
Col = 1
Row = 1
Set colItems = nothing
XL.Rows("2:2").Select
XL.ActiveWindow.FreezePanes = True
XL.Range("A2").Select
End Sub
3

Potrebbero piacerti anche