PowerShell CMDLets added for SQL2016 Always Encrypted
The post on the SQLServer blog at TechNet by the SQL Server Tools Team today made me jump out of my seat. The July update for SSMS includes the first substantial improvement in SQL PowerShell in many...
View ArticleUsing the new SQLServer Powershell module to get SQL Agent Job Information
So with the July Release of SSMS everything changed for using PowerShell with SQL. You can read the details here As I mentioned in my previous post the name of the module has changed to sqlserver This...
View ArticleConverting SQL Agent Job Duration to TimeSpan using PowerShell
When you look in msdb for the SQL Agent Job duration you will find that it is an int. This is also the same when you look at Get-SQLAgentJobHistory from the sqlserver module. (You can get this by...
View ArticlePowerShell, Pester and Ola Hallengrens Maintenance Solution
If you are a SQL DBA you will have heard of Ola Hallengrens Maintenance solution If you haven’t go and click the link and look at the easiest way to ensure that all of your essential database...
View ArticleSpeaking? You? Go on. #tsql2sday #84
This is a blog post for this month’s T-SQL Tuesday post, hosted by Andy Yun (b|t). T-SQL Tuesday is a monthly blog event started by Adam Machanic (b|t). The T-SQL Tuesday topic this month was about...
View ArticleRunning SQL Queries with Visual Studio Code
Reading this blog post by Shawn Melton Introduction of Visual Studio Code for DBAs reminded me that whilst I use Visual Studio Code (which I shall refer to as Code from here on) for writing PowerShell...
View ArticleUsing the PowerShell SQL Provider with SQL Authentication
Whilst having a conversation with Chrissy LeMaire last week about using the SQL Provider. She asked if it could use SQL Authentication. I had no idea but said I would find out. This is how and what I...
View ArticleAltering a Job Step on Hundreds of SQL Servers with PowerShell
I flew to Utrecht last week to present with Chrissy LeMaire and Sander Stad to present to the joint Dutch SQL and PowerShell User Groups. Whilst I was sat at the airport I got a phone call from my...
View ArticleAdding a T-SQL Job Step to a SQL Agent Job with PowerShell
In my last post, I explained how to alter an existing job step across many servers. I also had cause to add a T-SQL Job step to a large number of jobs as well. This is how I did it. As before I...
View ArticleQuickly Creating Test Users in SQL Server with PowerShell using the sqlserver...
One of the most visited posts on my blog is nearly two and half years old now – Add User to SQL Server Database Role with PowerShell and Quickly Creating Test Users. I thought it was time to update it...
View ArticleAdding a PowerShell Job Step to an existing SQL Agent Job Step with PowerShell
In my last post I showed how to add a T-SQL Job step to an existing SQL Agent Job. The process is exactly the same for a PowerShell job step. As before I gathered the required jobs using...
View ArticleTesting Your SQL Server Backups the Easy Way with PowerShell & dbatools
In a previous post I wrote about how easy it was to restore a whole SQL Servers user databases from a directory using the dbatools module. Maybe it is a good idea to look at for disaster recovery...
View ArticleTaking dbatools Test-DbaLastBackup a little further
In a previous post I showed how easy it is to test your backups using Test-DbaLastBackup Today I thought I would take it a little further and show you how PowerShell can be used to transmit or store...
View ArticleBacking up SQL Server on Linux using Ola Hallengrens Maintenance Solution
With the release of SQL Server vNext CTP 1.4 SQL Agent was released for use on Linux. To install it on Ubuntu you need to upgrade your SQL Server to CTP 1.4. On Ubuntu you do this with sudo apt-get...
View ArticleUsing Pester with dbatools Test-DbaLastBackup
In previous posts I have shown how to use Test-DbaLastBackup from dbatools and how you can make use of the results. Today we will look at using Pester with the results Pester provides a framework for...
View ArticleTest your Sqlserver backups on Linux with PowerShell and dbatools
I have written about Test-DbaLastBackup in posts here, here and here. They have been Windows only posts. With SQL Server vNext CTP 1.4 now available and providing SQL Agent capability on Linux, I wrote...
View ArticleGetting SQL Server File Sizes and Space Used with dbatools
I read a great blog post about answering the question how big is the database using T-SQL on SQL Buffet and wondered how much I could do with the dbatools module The dbatools module (for those that...
View ArticleMax Length of a column in a DataTable in PowerShell
Whilst I was writing my Test-DbaLastBackup Posts I ran into a common error I get when importing datatables into a database I was using this table and when I tried to add the results of the...
View ArticleTest the SQL Server database collation with PowerShell and dbatools
If your server collation is different to your database collation then you may find that you get an error similar to this Cannot resolve the collation conflict between “SQL_Latin1_General_CP1_CI_AS” and...
View ArticleGetting SQLServers Last Known Good DBCC Checkdb with PowerShell and dbatools
As good SQL Server DBA’s we want to ensure that our databases are regularly checked for consistency by running DBCC CheckDB. This will be frequently scheduled using an Agent Job or by using Ola...
View Article