SQL Profiler and Management Studio batch files for launching

SQL Profiler
Sometimes you want to run your profiler as a different user than the user that is logged onto the machine and uses a template of your choice then the following lines in a batch file can help you.

SET SSMSEXE=C:\Program Files\Microsoft SQL Server\100\Tools\Binn\PROFILER.EXE
C:\WINDOWS\system32\runas.exe /user:Domain\otheruser /savecred "%SSMSEXE% /S spa /T mytemplate"

Launching Management Studio with Domain\OtherUser,windows authentication and dv_dev as default database.

SET SSMSEXE=C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe
C:\WINDOWS\system32\runas.exe /user:Domain\OtherUser /savecred "%SSMSEXE% -s spa -d DB_Dev -E -nosplash"
Tested under SQL Server 2008R2 only.


Popular posts from this blog

Duplicate Folders Freeware - Not Duplicate Files

SSRS Compile Errors

Free SQL Server Management Studio Addin/Plugin/External Tool to get object information quickly