Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS=domain\account /SAPWD=SApassword /SQLCOLLATION=Latin1_General_CI_AS
Check the location of the physical data files:SELECT name, physical_name AS current_file_locationFROM sys .master_filesWHERE database_id IN (DB_ID ('master'), DB_ID( 'model'), DB_ID('msdb' ), DB_ID('tempdb' ));
Move the tempdb files if required:USE master ;GOALTER DATABASE tempdbMODIFY FILE (NAME = tempdev, FILENAME = 'F:\MSSQLData\tempdb.mdf');GOALTER DATABASE tempdbMODIFY FILE (NAME = templog, FILENAME = 'F:\MSSQLLogs\templog.ldf');GO
Once the files have been moved and the service restarted then the tempdb files created during the rebuild can be removed from the old location.You may want to disable the sa account:ALTER LOGIN sa DISABLE;