Automate SSMS 2016 with Visual Commander

Visual Commander v2.5 adds supports for SQL Server Management Studio 2016 (July v13.0.15500.91 and newer releases):

With Visual Commander you can record a text editing macro and play it back multiple times. You can save and edit the recorded macro as a C# or VB command to add more functionality to it.

You can create commands to quickly insert predefined or generated text to the editor, for example Insert current date and time.

You can access SSMS automation API not available with standard commands and controls. For example, SSMS doesn’t include an extension manager, but you can List installed extensions and you can uninstall an extension (Visual Commander) with the following C# command (References – Microsoft.VisualStudio.ExtensionManager):

public class C : VisualCommanderExt.ICommand
{
    public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) 
    {
        System.IServiceProvider serviceProvider = package as System.IServiceProvider;
        Microsoft.VisualStudio.ExtensionManager.IVsExtensionManager em =
           (Microsoft.VisualStudio.ExtensionManager.IVsExtensionManager)serviceProvider.GetService(
                typeof(Microsoft.VisualStudio.ExtensionManager.SVsExtensionManager));
	
        Microsoft.VisualStudio.ExtensionManager.IInstalledExtension vcmd = 
            em.GetInstalledExtension("e4b1fd83-b59d-41ca-a21d-19b10230ece5");
        em.Uninstall(vcmd);
        System.Windows.MessageBox.Show(vcmd.Header.Name + " has been uninstalled.");
    }
}

You can subscribe to internal SSMS events and perform automatic tasks with Visual Commander extensions. For example, AutoSave code when SSMS loses focus.

Please, share your ideas and code to automate repetitive SSMS tasks in comments.

Download link: Visual Commander for SSMS 2016 v2.5.

This entry was posted in Vlasov Studio tools and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s