Monday, April 4, 2011

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.

No comments:

Post a Comment

IIS Manager Crashes on Load/Start Windows 7, IIS 7.5

IIS Manager Crashes on Start  Windows 7, IIS 7.5, Power Shell 5.1. Here is the error I got in the event viewer. IISMANAGER_CRASH IIS Ma...