PowerShell: Script Out SQL Server Objects DDL To Folder Using dbatools

Today, I am going to show a simple script that uses dbatools to script out SQL Server Database level objects like Tables, Views, Stored Procedures, SQL Agent Jobs, Triggers, Database Users, etc., With dbatools, it is simple enough to also script out Instance level objects like logins, database mail profiles/accounts, credentials, SQL Agent objects, linked … Continue reading PowerShell: Script Out SQL Server Objects DDL To Folder Using dbatools

SQL Server: Copy Data from Large Tables to Target in a Resumable Fashion!

If you are looking for something that copies a set of tables from one SQL Server instance to another with all the indexes included, you can use my PowerShell Table Copy script that I have blogged about before. A single large table copy - Say No to "All or nothing"! The purpose of this post … Continue reading SQL Server: Copy Data from Large Tables to Target in a Resumable Fashion!

PowerShell & SQL Server: Unmask All Masked Columns (Dynamic Data Masking) In Database

Necessity is the mother of new PowerShell code :-)! Today, I had to unmask all the columns I had helped mask using Dynamic Data Masking. This simple post assumes that you are a privileged user with the ability to drop "Column Masking"! Identify Masked Columns The SQL to identify all masked columns is pretty simple … Continue reading PowerShell & SQL Server: Unmask All Masked Columns (Dynamic Data Masking) In Database

SQL Server: Fix – The server principal “elevated_user_login” is not able to access the database “my_database” under the current security context

The Error: This error wasted my morning. Although I have solved this issue before, it took a while to google and fix it again. So, this post is for my own edification and reference if for no other reason! --Proc [MyProcedureName] started AT:2020-10-13 09:49:43.4632735Msg 916, Level 14, State 1, Procedure MySchemaName.MyProcedureName, Line 31 [Batch Start … Continue reading SQL Server: Fix – The server principal “elevated_user_login” is not able to access the database “my_database” under the current security context

PowerShell & WPF: Marry Them For Reusable Scripts & Beautiful GUI!

This post is just to give you an idea of what is possible with PowerShell and WPF. It is not a complete solution that is ready to use. I do give you the key functions necessary to make it all work for your scenario and choices you want to make. As an Admin and an … Continue reading PowerShell & WPF: Marry Them For Reusable Scripts & Beautiful GUI!