Computer Inventory - Win32_PhysicalMemory



Good evening!

Sorta new to ADSI/WMI and having a bit of a problem with
Win32_PhysicalMemory. With the below pasted code it seems that I am getting
just the last slot (there are two slots - A0 and A1 - on the motherboard,
both populated with 256MB sticks). Does anyone see anything blatantly
obvious?

++++++++++++++++++++++++++++++++

strComputer = "."

Set objShell = CreateObject("WScript.Shell")
strCommand = "%comspec% /c ping -n 3 -w 1000 " & strComputer & ""
Set objExecObject = objShell.Exec(strCommand)

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=Impersonate," _
& "authenticationLevel=Pkt}!\\" _
& strComputer & "\root\CIMV2")

Set colItems1 = objWMIService.ExecQuery("SELECT * FROM
Win32_OperatingSystem",,48)
Set colItems2 = objWMIService.ExecQuery("SELECT * FROM
Win32_Processor",,48)
Set colItems3 = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem",,48)
Set colItems4 = objWMIService.ExecQuery("SELECT * FROM
Win32_PhysicalMemory",,48)
Set colItems5 = objWMIService.ExecQuery("SELECT * FROM
Win32_DiskDrive",,48)
Set colItems6 = objWMIService.ExecQuery("SELECT * FROM
Win32_VideoController",,48)
Set colItems7 = objWMIService.ExecQuery("SELECT * FROM
Win32_SoundDevice",,48)
Set colItems8 = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter
WHERE NetConnectionStatus=2",,48)


For Each objItem in colItems1
strOperatingSystem = objItem.Caption
strServicePack = objItem.ServicePackMajorVersion
strSerialNumber = objItem.SerialNumber
Next

For Each objItem in colItems2
strProcessor = objItem.Name
Next

For Each objItem in colItems3
strName = objItem.Name
Next

For Each objItem in colItems4
strSlot = objItem.DeviceLocator
strRAM = (objItem.Capacity/1048576)/1024
Next

For Each objItem in colItems5
strDiskCaption = objItem.Caption
strDiskSize = ROUND((objItem.Size/1048576)/1024, 2)
strInterface = objItem.InterfaceType
Next

For Each objItem in colItems6
strVideo = objItem.Caption
strVideoMode = objItem.VideoModeDescription
strVideoRAM = objItem.AdapterRAM/1048576
Next

For Each objItem in colItems7
strAudio = objItem.Caption
Next

For Each objItem in colItems8
strNIC = objItem.Caption
Next

If Err.Number > 0 then
strErrorSystems = strComputer & ", " & strErrorSystems
else
WScript.Echo
"=============================================================="
WScript.Echo "Computer Name: " & strName
WScript.Echo
"=============================================================="
Wscript.Echo "Operating System: " & strOperatingSystem & ", Service Pack
" & strServicePack
WScript.Echo "CPU Installed: " & strProcessor
Wscript.Echo "Memory slot: " & strSlot
WScript.Echo "RAM installed in Slot: " & strRAM & " GB"
WScript.Echo "Hard Drive: " & strDiskCaption
WScript.Echo "Hard Drive Size: " & strDiskSize & " GB"
WScript.Echo "Hard Drive Type: " & strInterface
WScript.Echo "Video Card: " & strVideo
WScript.Echo "Resolution: " & strVideoMode
WScript.Echo "Video Adapter RAM: " & strVideoRAM & " MB"
WScript.Echo "Sound Card: " & strAudio
WScript.Echo "Network Interface: " & strNIC
WScript.Echo
"=============================================================="

End If

++++++++++++++++++++++++++

Thanks,

--
Cary W. Shultz
Roanoke, VA 24012


.


Loading