Clean up your dbatools

It’s easy to get the latest version of the dbatools PowerShell module:
Update-Module -Name dbatools
However, this does not remove the old versions. Those stay around until you manually do something about it.

To see all the versions installed, this command is helpful:
Get-Module -Name dbatools -ListAvailable | Select-Object Name, Version, Path

Why clean them up?
1) Remove clutter and free up space
2) Eliminates questions about exactly which version you’re running
3) Removes duplicates in the ISE Commands tab like this…

Clean it up
The process is made simple by a script included in dbatools, cleanup.ps1. It is not exposed as a public function, so you need to run it from the module directory.
You could get the full file location or change directory into the path listed for the latest version installed in the above Get-Module output and execute the cleanup.ps1 script.

There is a simpler and repeatable one-liner method that I found in one of Shawn Melton‘s GitHub comments.
It can be run with this command, in an Administrative PowerShell command window, ISE is not supported:
& "$((Get-InstalledModule dbatools).InstalledLocation)\cleanup.ps1"
It will show you the current versions, and then ask you to confirm the removal action.
Then you just have to wait for the cleanup to run (some 3rd party Anti-Virus products can slow down this step)

Confirm it
Then you just run that Get-Module command again:
Get-Module -Name dbatools -ListAvailable | Select-Object Name, Version, Path

A much cleaner set of modules!


Introducing ISDeploymentCmd

A few months back, after resuming SSIS development full-time on a new team, I began to look for ways to incrementally improve the processes causing pain around deployments. New or improved packages would be sent to the DBA in the form of an ISPAC and then he’d open SSMS and deploy to the target server using the context menu on the catalog.

This had a few challenges and opportunities for improvement. We support both SQL 2012 & 2014, so it is critical to use the right Management Studio for the job, otherwise the PackageFormatVersion is incorrect. In addition, I have a preference for using scripted deploys, taking the GUI and (some) of the human element out altogether.

I began researching solutions and very quickly remembered that ISDeploymentWizard.exe had a silent mode. In fact it reminds us about this every time we deploy!

I began using ISDeploymentWizard.exe in my releases to Test and Production environments and had some quick success by calling it in a batch file for the DBA to execute. This worked great until I tried to reproduce the process with other team members. I found that people had several versions of SSMS and BIDS/Data Tools/Visual Studio installed and that moving ISDeploymentWizard.exe around to these different machines got mixed results due to varying versions of the DLL dependencies, such as Microsoft.SqlServer.ManagedDTS. They also needed SQL Data Tools or Developer Edition to have the functionality at all. When trying to run ISDeploymentWizard.exe on a machine without all the dependencies, an error window like this pops up:

I wanted something easy to distribute to all the team members and simple to use. I also wanted it to work on a vanilla install of Windows, so that the DBA could run the process on a deploy machine that didn’t necessarily need a SQL Server install. This ruled out the PowerShell solutions that reference a non-redistributable DLL. Eliminating this dependency would also make things easier in the future on a build agent in an automated process.

As I wanted to share this as a free and open source app, I wrote a ISDeploymentCmd, a C# console app on my own time over a weekend. It’s a wrapper around the public SSIS Catalog Stored Procedures that supports the same command line arguments as ISDeploymentWizard.exe. It also adds some additional capabilities, such as logging output. Now, with a simple find/replace in my previously mentioned batch file scripts, I’ve swapped in this tool and had success both in the developer team and in the integration to other environments. At this point it has now been used all the way to Production successfully several times by multiple teams.

Feel free to check out the project on GitHub and grab a copy of the executable on the releases page to try out yourself.


SSRS and Kerberos with a Cluster

I recently came across an error involving SQL Server Reporting Services (SSRS) that I recognized immediately but still took me some time to resolve due to intricacies of this particular environment.

This involves a scenario with a Web App calling into SSRS which then connects to a separate SQL Cluster.

The admin of the Web App reported this error when calling SSRS:

An error has occurred during report processing. (rsProcessingAborted) Cannot create a connection to data source ‘DataSource’. (rsErrorOpeningConnection)
For more information about this error navigate to the report server on the local server machine, or enable remote errors

As usual, not a lot of details. So I went into the Report Manager web interface (from a workstation) and tested the datasource, which turned out to be using Windows integrated security. I got


I had a feeling this was Kerberos related right away. The Web App admin, agreed and mentioned adding SPNs.

After much research, I found that the needed SPNs are

  • HTTP / SSRS server, with no port
  • SQL cluster, with SQL port

In my environment the SSRS server is accessed by its machine name but if it had a separate DNS entry or was load-balanced, this would have changed the name I needed to register.

We also had multiple nodes in the SQL cluster but the report datasource used the cluster name, so it is the name that matters for the “second hop”.

The solution that worked for us was like this:

setspn -a HTTP/ReportServer mydomainsqlreportsvc setspn -a HTTP/ReportServer.mydomain.local mydomainsqlreportsvc setspn -a MSSQLSvc/SqlCluster:1433 mydomainsqlEngineServiceAcct setspn -a MSSQLSvc/SqlCluster.mydomain.local:1433 mydomainsqlEngineServiceAcct 

In this example the SSRS machine name is “ReportServer” in the “mydomain.local” domain running with a services account of “sqlreportsvc”. The multi-node SQL cluster had a cluster name of “SqlCluster” and it was running on port 1433. Names have been changed to protect the innocent.

Shout out:
I have to say Scott Stauffer’s chapter on Kerberos in SQL Server MVP Deep Dives was an excellent resource for me during the problem solving and fix of this issue.


Little fish, big pond

The SQL Server Community feels large. There are so many resources online at my disposal that I may even say it is bit overwhelming.

There so are many that greats that came before me which leads me to ask, what could I possibly contribute by having yet another blog?

The answer is quite simple – it is a challenge to myself. A challenge to begin sharing and contibuting more often. I have been a dark matter DBA for far too long!

The quest begins online now. Eventually, I may put together material that is interesting enough and work up the courage to present in person at an event such as a SQL Saturday, Code Camp, or other user group.

In writing this, I’m looking forward to the grand SQL Server event of them all, PASS Summit. From past experience, I shall be returning all insipred, fired up, and ready to apply all the great new nuggets that are learned.

To all the SQL Family, hope to see you around, both online and at live events.