MSSQL DBA and PowerShell Cheat Sheet

This post contains useful scripts for a SQL Server Database Administrator. This page will be updated as more SQL DBA blog posts are published here at

SQL DBA Scripts

Diagnostic Scripts for SQL Server:

1. Performance Troubleshooting Script for SQL Server
2. SQL Script: Get CPU Utilization History
3. SQL Script: Get Most Frequently Executed Queries
4. SQL Script: Get Database Growth Events
5. SQL Script: Get Database Sizes and Free Space
6. SQL Script: Get SQL Server Services Info
7. SQL Script: Get Estimated Database Backup and Restore Times
8. SQL Script: Get Last Database Backup Dates
9. SQL Script: Check if Query Store is Enabled in SQL Server
10. PowerShell Script: Get Last SQL Failover Time

Operational Scripts for SQL Server:

1. SQL Script: Disable All SQL Agent Jobs
2. SQL Script: Kill All User SPIDs
3. PowerShell Script: Enable TCP Connections in SQL Server

SQL Permissions:

1. SQL Script: User Permissions Audit

Windows Administration with PowerShell:

1. Automating PowerShell Scripts with Task Scheduler in Windows
2. PowerShell: Get Tail of Log Files
3. PowerShell: Get-ChildItem, a Comprehensive Guide
4. PowerShell Script: List Files with Sizes and Dates
5. PowerShell Script: Remove Quotes from CSV Files in a Folder
6. PowerShell Script: Deleting Files Older Than a Specific Date
7. PowerShell Script: Count Rows in CSV Files
8. PowerShell Guide: Deleting Files and Folders

2 thoughts on “MSSQL DBA and PowerShell Cheat Sheet

Leave a Reply

Your email address will not be published. Required fields are marked *