Shrink Direct Access Database using PowerShell.

We recently ran into an issue where the a system was running out of space on the system-drive. After initial investigation we’ve discovered that Direct Access Database Windows Internal Database was consuming a lot of drive-space on a system-drive. Below I will explain how to shrink Direct Access database

Shrink Direct Access Database

Direct Access folder size

In the output above we used RoboCopy to calculate the folder sizes, if you want to know more about that, read my previous blog post here: “Faster Dir Size calculations in PowerShell!”

After spending some time searching the Internet, I couldn’t find a guide on how to shrink the Direct Access Windows Internal Database. Hence, I’ve created a PowerShell module. The first cmdlet will show you the exact size of the DA DataBase:

The Second cmdlet shrinks the DB:

11.8GB recovered!

Shrink Direct Access Database – PowerShell module.

You can find the PowerShell module on my GitHub page here: “ShrinkDaDataBase”. Also a thank you to Jaap Brasser who created “FixDaDatabase” which was a starting point for my module. Full code:

This article has 2 comments

  1. Akbar Reply

    Hi. This sounds like a problem I’m having. Will my clients lose connectivity if I run this program?

Leave a Comment

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