On windows machines you can get that information using a WMI query. I don’t have the exact query at hand, but a Google search could offer some hints.
On other OSes I have been able to get it through SNMP, but an appropriate SNMP agent needs to be running on the box (which means that the information is already on the machine and the agent just reads it to expose it through SNMP).
*******************************************************
msinfo32 returns this as well.
********************************************************
Discuss This Question: