SQL Server Power Search - Get More Relevant Results

SQL Server Scripts

 

Why reinvent the wheel? SQL Server scripts, written in Transact-SQL, PowerShell and VBScript, are listed in this section of the site. Some of these I have written myself. Others I have found on various sites, or have been contributed by colleagues.

My primary motivation for this is to create a central library of scripts for my own use. I've destroyed so many USB drives recently that this seems the best way of keeping them safe!

You are, of course, welcome to copy these scripts for your own use.

If you have any SQL Server scripts you would like to share, or suggestions for something you'd like me to write, please contact me.

TSQL

xp_cmdshell Alternative

An xp_cmdshell alternative is useful in an environment where the use of xp_cmdshell is locked down...

Get Running Requests

A script to get all currently running requests, together with the command, resources used, login name, etc...

Most Expensive Requests

This gets the requests that have used most resources since the last service restart...

Wait Stats

Report on all wait types, listing the total wait time for each...

Virtual File Stats

Report on the virtual file stats, showing the files with the highest latency...

Blocking Processes

List all processes in a blocking chain...

POWERSHELL

PowerShell Backup Check

Enumerates multiple servers and reports databases with overdue backups...

Physical CPU Count

How to get the physical CPU count for a server using PowerShell...

sp_help_revlogin Alternative

A PowerShell alternative to sp_help_revlogin...

VBSCRIPT

SQL Server Audit Script - Part 1

This article describes a script I have written to retrieve server and instance configuration from all specified servers...

SQL Server Audit Script - Part 2

This article gives the code for the HTA application, written in vbscript, that performs the audit described in the first article...

SQL Server Monitoring Script - Part 1

This article describes a script I have written to automate my morning checks in a large environment...

SQL Server Monitoring Script - Part 2

This article gives the code for the script that performs the monitoring described in the first article...

I will add further scripts and TSQL to this page over time. Watch this space...