There are a number of ways you can do it, WMI will let you capture most of the data, however it may be easier to setup a counter log in Perfmon.
Check this article out at MS:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/monitoring_performance_data.asp
MS Scripts...