SQL Server Setup error on Vista: Failed to compile the Managed Object Format (MOF) file ...

I encountered this when installing SQL Server on a new Vista machine. The full error is:

SQL Server Setup Failed to compile the Managed Object Format (MOF) file C:\Program Files\Microsoft SQL Server\90\Shared\sqlmgmproviderxpsp2up.mof. To proceed, see "Troubleshooting an Installation of SQL Server 2005" or "How to: View SQL Server 2005 Setup Log Files" in SQL Server 2005 Setup Help documentation.

The error occurs during the "Installing WMI registration" step. You don't need to look at the setup log files, or reinstall WMI (Windows Management Instrumentation), as some web postings I found suggested. The problem comes from corruption in the WMI repository, and it can be repaired easily. From a command prompt, running as administrator, run:

winmgmt /salvagerepository

You'll get an error, but the command has sent a stop request to the WMI service. Run the command a second time, and it will repair the repository and the SQL Server installation can continue.

Thanks to Ciprian Jichici: http://www.ciprianjichici.ro/blog/Entry.aspx?EntryID=350cfb29-4c99-4807-...