dbpath = "Win32_PerfRawData_" + a suffix depending on the instance name.
"select dataFilesSizeKb, logFilesSizeKb, logFilesUsedSizeKb, Name from " + dbPath + " where name != \"_Total\""
You can try repairing the .mof files on your sql server first: http://www.lansweeper.com/kb/37/SQL-server-not-detected.html