Category Archives: Scripts


More and more often it seems that the WSUS DB becomes too large that it causes multiple issues especially with SCCM integration (SCUP). You may not be able to perform the required maintenance using scripts (Download Here)  but often enough the service will crash thus you will need to troubleshoot at the SQL/WID level to perform a cleanup.

SQL/WID Cleanup Queries

Download the scripts here and run in order:

SQLQuery – 1 Remove Unused Updates
SQLQuery – 2 Remove Hidden Updates
SQLQuery – 3 Re-index Database

If your SUSDB is on a dedicated SQL Instance, connect to that  server/DB and run the SQL Queries.

If you are running Windows Internal Database, this will still require SQL Management Studio (Run As Administrator)

Server Name to connect to

2012 (or later) \\.\pipe\MICROSOFT##WID\tsql\query
2003 & 2008  \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query

GPO Backup and Email of GPO Modifications

Recently I wrote a Powershell script that backs up Group Policies and also sends an email of Group Policies modified within a specified time.  Works well setup on a scheduled task to take care of GPO Backups.

Download Here: GPO_Backup_1.2

The following fields can be modified to suite your requirements

$BUlocation = "C:\GPOBackups" #where the GPOs Backups will be located
$BUresults = "Backup-results.txt" #name of the ouput file (for reference)
$days = 15 #number days old bacups to be auto deleted
$dc = "domaincontroller" #hostname of the DC for backing up
$SMTPserver = "" #SMTP server name
$SendTo = "" #Send email to this address

Also for the email sent you can change how long to capture the modifications

eg. 24 Hours

$body = Get-GPOModifications -Hours 24

eg. 7 Days

$body = Get-GPOModifications -Days 7

Hope you find this one useful 🙂