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

MSSQL DBA Scripts:

Diagnostic Scripts

1. Quick Performance Troubleshooting Script for SQL Server
2. SQL Script to Get CPU Utilization History
3. SQL Server Script: Show Database Growth Events
4. SQL Server Script: Get Database Sizes and Free Space

Operational Scripts

1. PowerShell: Get Last SQL Failover Time
2. SQL Server Script: Disable All SQL Agent Jobs
3. SQL Server Script: Get Last Backup Dates
4. SQL Server Script: Kill All User SPIDs
5. SQL Server Script: Estimating Database Backup and Restore Times
6. PowerShell: Enabling TCP Connections in SQL Server

SQL Permissions

1. SQL Server Script: User Permissions Audit

Other Windows Admin

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

Leave a Reply

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