Question Locked

finding out memory modules for multiple pcs

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hello to all first post and hopefully a nice greeting and answer

we have 600 pc's which we would like to upgrade to 1gb of memory simple you say hmm yeah, problem i have i need to find out what the machine have as memory module to be able to purchase the correct amount. pc consist of at present

512mb= 2x 256mb
or
512mb= 2x128 + 1 x256

so you can see hwy i need to know what modules are in the pc's all the 128mb will be ditched and new 256mb purchased to fill th 4 slots

SIW and BELARC do a fantastic job if you have the time and patience to go around every pc but i dont. reall y could do with this automated

we have SMS but again this will only give us a total quantity not individule memory module sizes

and help much appreciated

7 replies

by oharaphil

For the number of machines that you are looking to upgrade i think you would be better off purchasing one of Belarc comercial licenses in order to automate the process. I dont believe you will find a free version of software that can provide the info you need without going round to all pc's to install manually....i could be wrong but i havent come across anything

by scott_heath

Using vbscript and WMI shall tell you what you need to know! You can add this code to the logon script and have it place the results in a file on the DC called memory.txt or run it from a server using a list of PC names. It's up to you. Here is the code:

sComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & sComputer & "\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory",,48)
For Each objItem in colItems
sMemLoc = objItem.DeviceLocator
sMemCap = CLng(objItem.Capacity) / (1024 * 1024)
sMemSpd = objItem.Speed
'Write the data somewhere
'View in msgbox for debug
Msgbox("Memory Location: " & sMemLoc & vbCrLf & _
"Memory Capacity: " & sMemCap & " MB" & vbCrLf & _
"Memory Speed : " & sMemSpd & vbCrLf)
Next

Set colitems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray where Use=3",,48)
For each objItem In colitems
sMaxMemCap = CLng(objItem.MaxCapacity) / 1024
sMaxMemDev = objItem.MemoryDevices
'Write the data somewhere
'View in msgbox for debug
Msgbox("Maximum Memory Capacity: " & sMaxMemCap & " MB" & vbCrLf & _
"Maximum Number of DIMMS: " & sMaxMemDev & vbCrLf)
Next

If you need help inserting it into a login script or running it against the computers in your domain just let me know.

by craig.parkinson

nice work there
being nothing of a script writer or as much as a vb guru as your self could you fill in the blanks

sComputer = "." DO I NEED TO ENTER ANYTHING IN THE QUOTES?
Set objWMIService = GetObject("winmgmts:\\" & sComputer & "\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory",,48)
For Each objItem in colItems
sMemLoc = objItem.DeviceLocator
sMemCap = CLng(objItem.Capacity) / (1024 * 1024)
sMemSpd = objItem.Speed
'Write the data somewhere <\\SERVER\LOC? HERE
'View in msgbox for debug
Msgbox("Memory Location: " & sMemLoc & vbCrLf & _
"Memory Capacity: " & sMemCap & " MB" & vbCrLf & _
"Memory Speed : " & sMemSpd & vbCrLf)
Next

Set colitems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray where Use=3",,48)
For each objItem In colitems
sMaxMemCap = CLng(objItem.MaxCapacity) / 1024
sMaxMemDev = objItem.MemoryDevices
'Write the data somewhere

by craig.parkinson

just as a after thought we can run this vb script through SMS
can i just have the report and not the windows
could do with a ltiile help setting the script to run here

by scott_heath

The first line depends on how you plan on running the script. I assume if you use SMS you will be launching the script to run on each specific machine locally, not running it from a server that connects to the machine remotely. When running the script locally the "." implies the current system, much like it can be used for the current directory in a cmd shell. If you where using list, either from a text file or a query of Active Directory the "." would be replaced with the variable name that represented the current computer in the array.

What I would do to write the data is make sure a share available for all users and that they can write to it. At the top of the script we will create a few new objects and set a couple of variables.

------------------------------------------------------------------------------------------
ForWriting = 2

Set oNetwork = WScript.CreateObject("WScript.Network")
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

sResultsFilePath = "\\server\share\" & oNetwork.Computername & "-meminv.txt"
Set oResultsFile = oFSO.OpenTextFile(sResultsFilePath, ForWriting, True)
------------------------------------------------------------------------------------------

So now we jump down to were we need to write data.

Win32_PhysicalMemory Section:
------------------------------------------------------------------------------------------
oResultsFile.WriteLine "Memory Location: " & sMemLoc & vbCrLf & _
"Memory Capacity: " & sMemCap & " MB" & vbCrLf & _
"Memory Speed : " & sMemSpd & vbCrLf

Win32_PhysicalMemoryArray Section:
------------------------------------------------------------------------------------------
oResultsFile.Writeline "Maximum Memory Capacity: " & sMaxMemCap & " MB" & vbCrLf & _
"Maximum Number of DIMMS: " & sMaxMemDev & vbCrLf

Then finally at the end:
------------------------------------------------------------------------------------------
oResultsFile.Close

Here is What the results look like:
------------------------------------------------------------------------------------------
Memory Location: DIMM_1
Memory Capacity: 1024 MB
Memory Speed : 533

Memory Location: DIMM_3
Memory Capacity: 512 MB
Memory Speed : 533

Memory Location: DIMM_2
Memory Capacity: 1024 MB
Memory Speed : 533

Maximum Memory Capacity: 4096 MB
Maximum Number of DIMMS: 4

by scott_heath

ForWriting = 2

Set oNetwork = WScript.CreateObject("WScript.Network")
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

sResultsFilePath = "\\server\share\" & oNetwork.Computername & "-meminv.txt"
Set oResultsFile = oFSO.OpenTextFile(sResultsFilePath, ForWriting, True)

sComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & sComputer & "\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory",,48)
For Each objItem in colItems
sMemLoc = objItem.DeviceLocator
sMemCap = CLng(objItem.Capacity) / (1024 * 1024)
sMemSpd = objItem.Speed
'Write the data somewhere
'View in msgbox for debug
oResultsFile.Writeline "Memory Location: " & sMemLoc & vbCrLf & _
"Memory Capacity: " & sMemCap & " MB" & vbCrLf & _
"Memory Speed : " & sMemSpd & vbCrLf
Next

Set colitems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray where Use=3",,48)
For each objItem In colitems
sMaxMemCap = CLng(objItem.MaxCapacity) / 1024
sMaxMemDev = objItem.MemoryDevices
'Write the data somewhere
'View in msgbox for debug
oResultsFile.Writeline "Maximum Memory Capacity: " & sMaxMemCap & " MB" & vbCrLf & _
"Maximum Number of DIMMS: " & sMaxMemDev & vbCrLf
Next

oResultsFile.Close

This discussion is closed to new replies.