Simply run
wmic MEMORYCHIP get BankLabel,DeviceLocator,Capacity,Tag
Result will come like this
>wmic MEMORYCHIP get BankLabel,DeviceLocator,Capacity,Tag
BankLabel Capacity DeviceLocator Tag
BANK 0 2147483648 Bottom - Slot 1 (top) Physical Memory 0
BANK 1 4294967296 Bottom - Slot 2 (under) Physical Memory 1
(DeviceLocator will likely give you DIMM numbers on a desktop machine – the top/under slots are because I’m on a laptop. Both BankLabel and DeviceLocator formats may vary by machine.)
There is a lot more data available, but it doesn’t display well in the limited columns of a command prompt. You can export it all to a text file for easier viewing (don’t forget to turn off word wrap):
>wmic MEMORYCHIP get >data.txt
>start data.txt
And you can use those extra columns to customise the first command to give you, e.g., the manufacturer name, product number and serial number.