You can use WMI. Read up on it on Wikipedia.

And here's an example written in Delphi - http://www.planet-source-code.com/vb...=tp%2FG6282254

Hope it helps.