Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#12 Physical Memory Configuration

open
nobody
5
2008-04-23
2008-04-23
Anonymous
No

Hello,
I want to audit physical memory configuration from pcs like:

On Error Resume Next

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray",,48)

For Each objItem in colItems

With objItem

If not IsNullOrEmpty(.Caption) then s = s & "Caption: " & .Caption & vbcrlf

If not IsNullOrEmpty(.CreationClassName) then s = s & "CreationClassName: " & .CreationClassName & vbcrlf

If not IsNullOrEmpty(.Depth) then s = s & "Depth: " & .Depth & vbcrlf

If not IsNullOrEmpty(.Description) then s = s & "Description: " & .Description & vbcrlf

If not IsNullOrEmpty(.Height) then s = s & "Height: " & .Height & vbcrlf

If not IsNullOrEmpty(.HotSwappable) then s = s & "HotSwappable: " & .HotSwappable & vbcrlf

If not IsNullOrEmpty(.InstallDate) then s = s & "InstallDate: " & .InstallDate & vbcrlf

If not IsNullOrEmpty(.Location) then s = s & "Location: " & .Location & " (" & GetLocation(.Location) & ")" & vbcrlf

If not IsNullOrEmpty(.Manufacturer) then s = s & "Manufacturer: " & .Manufacturer & vbcrlf

If not IsNullOrEmpty(.MaxCapacity) then s = s & "MaxCapacity: " & .MaxCapacity/1024 & " MB" & vbcrlf

If not IsNullOrEmpty(.MemoryDevices) then s = s & "MemoryDevices: " & .MemoryDevices & vbcrlf

If not IsNullOrEmpty(.MemoryErrorCorrection) then s = s & "MemoryErrorCorrection: " & .MemoryErrorCorrection & " (" & GetMemoryErrorCorrection(.MemoryErrorCorrection) & ")" & vbcrlf

If not IsNullOrEmpty(.Model) then s = s & "Model: " & .Model & vbcrlf

If not IsNullOrEmpty(.Name) then s = s & "Name: " & .Name & vbcrlf

If not IsNullOrEmpty(.OtherIdentifyingInfo) then s = s & "OtherIdentifyingInfo: " & .OtherIdentifyingInfo & vbcrlf

If not IsNullOrEmpty(.PartNumber) then s = s & "PartNumber: " & .PartNumber & vbcrlf

If not IsNullOrEmpty(.PoweredOn) then s = s & "PoweredOn: " & .PoweredOn & vbcrlf

If not IsNullOrEmpty(.Removable) then s = s & "Removable: " & .Removable & vbcrlf

If not IsNullOrEmpty(.Replaceable) then s = s & "Replaceable: " & .Replaceable & vbcrlf

If not IsNullOrEmpty(.SerialNumber) then s = s & "SerialNumber: " & .SerialNumber & vbcrlf

If not IsNullOrEmpty(.SKU) then s = s & "SKU: " & .SKU & vbcrlf

If not IsNullOrEmpty(.Status) then s = s & "Status: " & .Status & vbcrlf

If not IsNullOrEmpty(.Tag) then s = s & "Tag: " & .Tag & vbcrlf

If not IsNullOrEmpty(.Use) then s = s & "Use: " & .Use & " (" & GetUse(.Use) & ")" & vbcrlf

If not IsNullOrEmpty(.Version) then s = s & "Version: " & .Version & vbcrlf

If not IsNullOrEmpty(.Weight) then s = s & "Weight: " & .Weight & vbcrlf

If not IsNullOrEmpty(.Width) then s = s & "Width: " & .Width & vbcrlf

s = s & vbcrlf

End With

Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)

For Each objItem in colItems

With objItem

If not IsNullOrEmpty(.BankLabel) then s = s & "BankLabel: " & .BankLabel & vbcrlf

If not IsNullOrEmpty(.Capacity) then s = s & "Capacity: " & .Capacity/1048576 & " MB" & vbcrlf

If not IsNullOrEmpty(.Caption) then s = s & "Caption: " & .Caption & vbcrlf

If not IsNullOrEmpty(.CreationClassName) then s = s & "CreationClassName: " & .CreationClassName & vbcrlf

If not IsNullOrEmpty(.DataWidth) then s = s & "DataWidth: " & .DataWidth & vbcrlf

If not IsNullOrEmpty(.Description) then s = s & "Description: " & .Description & vbcrlf

If not IsNullOrEmpty(.DeviceLocator) then s = s & "DeviceLocator: " & .DeviceLocator & vbcrlf

If not IsNullOrEmpty(.FormFactor) then s = s & "FormFactor: " & .FormFactor & " (" & GetFormFactor(.FormFactor) & ")" & vbcrlf

If not IsNullOrEmpty(.HotSwappable) then s = s & "HotSwappable: " & .HotSwappable & vbcrlf

If not IsNullOrEmpty(.InstallDate) then s = s & "InstallDate: " & .InstallDate & vbcrlf

If not IsNullOrEmpty(.InterleaveDataDepth) then s = s & "InterleaveDataDepth: " & .InterleaveDataDepth & vbcrlf

If not IsNullOrEmpty(.InterleavePosition) then s = s & "InterleavePosition: " & .InterleavePosition & " (" & GetInterleavePosition(.InterleavePosition) & ")" & vbcrlf

If not IsNullOrEmpty(.Manufacturer) then s = s & "Manufacturer: " & .Manufacturer & vbcrlf

If not IsNullOrEmpty(.MemoryType) then s = s & "MemoryType: " & .MemoryType & " (" & GetMemoryType(.MemoryType) & ")" & vbcrlf

If not IsNullOrEmpty(.Model) then s = s & "Model: " & .Model & vbcrlf

If not IsNullOrEmpty(.Name) then s = s & "Name: " & .Name & vbcrlf

If not IsNullOrEmpty(.OtherIdentifyingInfo) then s = s & "OtherIdentifyingInfo: " & .OtherIdentifyingInfo & vbcrlf

If not IsNullOrEmpty(.PartNumber) then s = s & "PartNumber: " & .PartNumber & vbcrlf

If not IsNullOrEmpty(.PositionInRow) then s = s & "PositionInRow: " & .PositionInRow & vbcrlf

If not IsNullOrEmpty(.PoweredOn) then s = s & "PoweredOn: " & .PoweredOn & vbcrlf

If not IsNullOrEmpty(.Removable) then s = s & "Removable: " & .Removable & vbcrlf

If not IsNullOrEmpty(.Replaceable) then s = s & "Replaceable: " & .Replaceable & vbcrlf

If not IsNullOrEmpty(.SerialNumber) then s = s & "SerialNumber: " & .SerialNumber & vbcrlf

If not IsNullOrEmpty(.SKU) then s = s & "SKU: " & .SKU & vbcrlf

If not IsNullOrEmpty(.Speed) then s = s & "Speed: " & .Speed & " ns" & vbcrlf

If not IsNullOrEmpty(.Status) then s = s & "Status: " & .Status & vbcrlf

If not IsNullOrEmpty(.Tag) then s = s & "Tag: " & .Tag & vbcrlf

If not IsNullOrEmpty(.TotalWidth) then s = s & "TotalWidth: " & .TotalWidth & vbcrlf

If not IsNullOrEmpty(.TypeDetail) then s = s & "TypeDetail: " & .TypeDetail & vbcrlf

If not IsNullOrEmpty(.Version) then s = s & "Version: " & .Version & vbcrlf

s = s & vbcrlf

End With

Next

wscript.echo s

Function IsNullOrEmpty(strTest)

IsNullOrEmpty=False

If IsNull(strTest) then

IsNullOrEmpty = True

Else

If IsEmpty(strTest) then

IsNullOrEmpty = True

Else

if trim(cstr(strTest))="" then IsNullOrEmpty = True

End If

End If

End Function

Function GetLocation(intTest)

Select Case intTest

Case 0: GetLocation="Reserved"

Case 1: GetLocation="Other"

Case 2: GetLocation="Unknown"

Case 3: GetLocation="System board or motherboard"

Case 4: GetLocation="ISA add-on card"

Case 5: GetLocation="EISA add-on card"

Case 6: GetLocation="PCI add-on card"

Case 7: GetLocation="MCA add-on card"

Case 8: GetLocation="PCMCIA add-on card"

Case 9: GetLocation="Proprietary add-on card"

Case 10: GetLocation="NuBus"

Case 11: GetLocation="PC-98/C20 add-on card"

Case 12: GetLocation="PC-98/C24 add-on card"

Case 13: GetLocation="PC-98/E add-on card"

Case 14: GetLocation="PC-98/Local bus add-on card"

End Select

End Function

Function GetMemoryErrorCorrection(intTest)

Select Case intTest

Case 0: GetMemoryErrorCorrection="Reserved"

Case 1: GetMemoryErrorCorrection="Other"

Case 2: GetMemoryErrorCorrection="Unknown"

Case 3: GetMemoryErrorCorrection="None"

Case 4: GetMemoryErrorCorrection="Parity"

Case 5: GetMemoryErrorCorrection="Single-bit ECC"

Case 6: GetMemoryErrorCorrection="Multi-bit ECC"

Case 7: GetMemoryErrorCorrection="CRC"

End Select

End Function

Function GetUse(intTest)

Select Case intTest

Case 0: GetUse="Reserved"

Case 1: GetUse="Other"

Case 2: GetUse="Unknown"

Case 3: GetUse="System memory"

Case 4: GetUse="Video memory"

Case 5: GetUse="Flash memory"

Case 6: GetUse="Nonvolatile RAM"

Case 7: GetUse="Cache memory"

End Select

End Function

Function GetFormfactor(intTest)

Select Case intTest

Case 0: GetFormfactor="Unknown"

Case 1: GetFormfactor="Other"

Case 2: GetFormfactor="SIP"

Case 3: GetFormfactor="DIP"

Case 4: GetFormfactor="ZIP"

Case 5: GetFormfactor="SOJ"

Case 6: GetFormfactor="Proprietary"

Case 7: GetFormfactor="SIMM"

Case 8: GetFormfactor="DIMM"

Case 9: GetFormfactor="TSOP"

Case 10: GetFormfactor="PGA"

Case 11: GetFormfactor="RIMM"

Case 12: GetFormfactor="SODIMM"

Case 13: GetFormfactor="SRIMM"

Case 14: GetFormfactor="SMD"

Case 15: GetFormfactor="SSMP"

Case 16: GetFormfactor="QFP"

Case 17: GetFormfactor="TQFP"

Case 18: GetFormfactor="SOIC"

Case 19: GetFormfactor="LCC"

Case 20: GetFormfactor="PLCC"

Case 21: GetFormfactor="BGA"

Case 22: GetFormfactor="FPBGA"

Case 23: GetFormfactor="LGA"

End Select

End Function

Function GetInterleavePosition(intTest)

Select Case intTest

Case 0: GetInterleavePosition="Noninterleaved"

Case 1: GetInterleavePosition="First position"

Case 2: GetInterleavePosition="Second position"

End Select

End Function

Function GetMemoryType(intTest)

Select Case intTest

Case 0: GetMemoryType="Unknown"

Case 1: GetMemoryType="Other"

Case 2: GetMemoryType="DRAM"

Case 3: GetMemoryType="Synchronous DRAM"

Case 4: GetMemoryType="Cache DRAM"

Case 5: GetMemoryType="EDO"

Case 6: GetMemoryType="EDRAM"

Case 7: GetMemoryType="VRAM"

Case 8: GetMemoryType="SRAM"

Case 9: GetMemoryType="RAM"

Case 10: GetMemoryType="ROM"

Case 11: GetMemoryType="Flash"

Case 12: GetMemoryType="EEPROM"

Case 13: GetMemoryType="FEPROM"

Case 14: GetMemoryType="EPROM"

Case 15: GetMemoryType="CDRAM"

Case 16: GetMemoryType="3DRAM"

Case 17: GetMemoryType="SDRAM"

Case 18: GetMemoryType="SGRAM"

Case 19: GetMemoryType="RDRAM"

Case 20: GetMemoryType="DDR"

Case 21: GetMemoryType="DDR-2"

End Select

End Function

Discussion