You could do this using the WMI Classes in the .NET Framework or use WindowsController available at http://www.mentalis.org