Generate SQL Server Role Member Reports using dbatools and ImportExcel PowerShell modules

This was initial posted on SQL Server Central articles. As one of dbatools' first members, I've been using it for years and it's really my goto tool. This task was no different! Today's tip and trick using dbatools is about generating an Excel workbook that contains lists of SQL Server roles and its members. The … Continue reading Generate SQL Server Role Member Reports using dbatools and ImportExcel PowerShell modules

Backup your SQL instances configurations to GIT with dbatools – Part 2 – Add parallelism

We have seen how we can export and save the results to a folder and commit them to a GIT repository on my last blog post Backup your SQL instances configurations to GIT with dbatools – Part 1. At the end of that post, I have mentioned that I would write about how we can … Continue reading Backup your SQL instances configurations to GIT with dbatools – Part 2 – Add parallelism

Backup your SQL instances configurations to GIT with dbatools – Part 1

Today I want to share how I'm keeping a copy of instances' configurations using dbatools. Chrissy LeMaire (B | T) wrote about it before on the Simplifying disaster recovery with dbatools blog post. In this post, I will add one step and save the output on a GIT repository. Pre-requirements You need a GIT repository … Continue reading Backup your SQL instances configurations to GIT with dbatools – Part 1

Replicate permissions to new Login/User with dbatools

Continuing to share tips and tricks using dbatools like the Refresh databases that belongs to availability group using dbatools posted a few days ago, today I will share a way to export the permissions of a login/user at instance/database level and apply them to a new login/user. The typical request Client: "We have a new … Continue reading Replicate permissions to new Login/User with dbatools

Export Deadlocks to file from system_health Extended Event using PowerShell

Just a quick post as may help any of you searching for this. Scenario Client wants to analyze most recent deadlocks that happened on a specific instance. They asked us to send the xdl files. How do we get the deadlocks? Depending on the version of SQL Server that you are running, there are different … Continue reading Export Deadlocks to file from system_health Extended Event using PowerShell

Refresh databases that belongs to Availability Group using dbatools

Few days ago I was surfing on Twitter when dbatools asked about how it's PowerShell module changed the way people work. https://twitter.com/psdbatools/status/1261563168113012736 Open and check the answers given by the community as there is really good stuff there! My turn I have shared one of my recipes related to database refreshes. You know, when the … Continue reading Refresh databases that belongs to Availability Group using dbatools

More PowerShell Remoting coverage in dbatools

Starting on dbatools version 1.0.31 we introduced better coverage for commands that make use of PowerShell Remoting. Which commands? Commands like Get-DbaComputerCertificate, Get-DbaPrivilege, Get-DbaClientAlias, just to mention a few of them, make use of the internal function Invoke-Command2 which uses New-PSSession when we run it against a remote computer. "Why have you changed it?" Let … Continue reading More PowerShell Remoting coverage in dbatools

“Ups…I have deleted some data. Can you put it back?” – dbatools for the rescue

Few days ago I received a request to restore a dozen of tables because someone have deleted more data than it was supposed. I immediately thought about dbatools for the job! NOTE: I also thought about SSMS "Import/Export Data". And this is ok when someone says "it's to run just once, just now". When you … Continue reading “Ups…I have deleted some data. Can you put it back?” – dbatools for the rescue

Scripting SQL Server objects with dbatools – Beyond default options

Probably you had the need to script out some objects from a SQL Server instance/database and this is quite easy. You just need to right click on the object (well...not on every single one, try it with an Availability Group :-), no script option available) select "Script XXXX as" and you have it. But have … Continue reading Scripting SQL Server objects with dbatools – Beyond default options