---
title: "Find Domain Controller Backup Schedules with Ease"
description: "Use repadmin and PowerShell to effortlessly find domain controller backup schedules."
canonical: "https://adamtheautomator.com/domain-controller-backup/"
---

# Find Domain Controller Backup Schedules with Ease

> Use repadmin and PowerShell to effortlessly find domain controller backup schedules.

Source: https://adamtheautomator.com/domain-controller-backup/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Find Domain Controller Backup Schedules with Ease](https://adamtheautomator.com/wp-content/uploads/2019/08/apocalypse-2459465_1920.jpg)

# Find Domain Controller Backup Schedules with Ease

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)7 August 20192 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Active Directory](/tag/active-directory/)[PowerShell](/tag/powershell/)

Table of Contents

*   [Understanding how Domain Controller Backups Work](#understanding-how-domain-controller-backups-work)
*   [Summary](#summary)

Everyone agrees that domain controller backups are important. Even multi-master services like Active Directory should be regularly backed up. Even though you’ve got copies of the Active Directory database and _SYSVOL_ on various servers spread throughout the world doesn’t mean you should simply ignore backups. Depending on replication intervals one wrong change can spread across your entire Active Directory environment quickly!

## Understanding how Domain Controller Backups Work

How do you determine if Active Directory is “backed up” anyway?

Since Active Directory technically exists on lots of servers (domain controllers) you can backup the Active Directory database on every domain controller. You can even get more granular and backup individual naming contexts or partitions as well.

Related:[Domain Controller vs Active Directory](https://adamtheautomator.com/domain-controller-vs-active-directory/)

Every time a partition is backed up on a domain controller, the event is recorded on the DC. Using the [repadmin utility](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc770963\(v=ws.11\)?redirectedfrom=MSDN) you can then query this date.

_Repadmin_ is a utility built into Windows Server 2008 and higher on DCs and is used to perform lot of different management functions around Active Directory. One of the functions of _repadmin_ is to find the last backup time of each partition in the Active Directory database.

![repadmin /showbackup to see your domain controller backup](/wp-content/uploads/2019/08/Picture1-17.png)

`repadmin /showbackup to see your domain controller backup`

You can see if you simply run `repadmin.exe /showbackup` it will query the backup times for each partition on the localhost. In this case, I ran it on a domain controller directly. However, you don’t have to do this. It would be more beneficial to get this information from all domain controllers in an entire forest to get a much bigger picture of the backup status of your domain controllers.

To do this, we’ll need some help from Windows PowerShell and its [Active Directory](https://www.microsoft.com/en-us/download/details.aspx?id=45520)  
[module](https://www.microsoft.com/en-us/download/details.aspx?id=45520). The [Active Directory module](https://adamtheautomator.com/powershell-import-active-directory/ "Active Directory module") has a handy cmdlet called `Get-ADForest` that will easily enumerate all domains that exist in the forest. One of the properties that `Get-ADForest` outputs is called `Domains`.

Related:[How to Install and Import the PowerShell Active Directory Module](https://adamtheautomator.com/powershell-import-active-directory/)

```powershell
PS51> $domains = (Get-ADForest).Domains
```

We now have a list of domains in the forest. Next, we’ll need to find all domain controllers in each of those domains. To do this, we can use the `Get-ADDomainController` cmdlet.

```powershell
$domainControllers = ($domains | foreach { Get-ADDomainController-Server $_ -Filter * }).HostName
```

Next, we’ll then pass each of these domain controllers to the _repadmin_ utility to find the last backup times for each Active Directory partition on each of the domain controllers.

```powershell
PS51> $backups = $domainControllers | foreach { repadmin.exe /server $_ }
```

This will get us a rough output of the domain controller backup dates of each partition on each domain controller in all of the domains in our current forest.

However, as you saw from the `repadmin /showbackup` output, the output isn’t that pretty and may be hard to read. For this, I’ll use PowerShell’s string parsing abilities and some regular expressions to get a much nicer-looking output.

```powershell
## Loop through each domain controller
$domainControllers | foreach {
    $backups = repadmin.exe /showbackup $_
    
    ## Capture the output ofrepadmin
    $output = @{ 'DomainController' = $_ }
    
    ## Start collectingproperties for output
    for ($i = 0; $i -lt $backups.Count; $i++) { ## Begin looking atrepadmin output
        if ($backups[$i] -match '^(CN|DC)') { ## If the line has apartition.
            ## Assign the partition name and the date/time to the output hashtable
            ## and send $output with the DomainController, Partition and DateTime
            $output.Partition = $backups[$i]
            $output.DateTime = [regex]::Match($backups[$i +2],'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})').Groups[1].Value
            [pscustomobject]$output
        }
    }
}
```

This will get you a much nicer-looking domain controller backup report.

![Repadmin.exe output parsed into objects](/wp-content/uploads/2019/08/Picture1-18.png)

_Repadmin.exe_ output parsed into objects

## Summary

Using the _repadmin_ command-line utility and a little bit of PowerShell-fu, you can find the last time all of your domain controllers were backed up. This is all returned to you in a nicely-formatted, object-oriented design with PowerShell.

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fdomain-controller-backup%2F&text=Find%20Domain%20Controller%20Backup%20Schedules%20with%20Ease)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fdomain-controller-backup%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fdomain-controller-backup%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2024/11/image-23.png)

### [Managing Active Directory Groups with PowerShell: The Ultimate Guide](/powershell-ad-groups-guide/)

Learn how to manage Active Directory groups with PowerShell! This hands-on guide shows you how to query, create and modify AD groups using practical real-world

![](https://adamtheautomator.com/wp-content/uploads/2019/08/database-152091_1280.png)

### [Active Directory Database: PowerShell Monitoring Made Easy](/active-directory-database/)

Find the ntds.dit location and monitor your Active Directory database using PowerShell.

![](https://adamtheautomator.com/wp-content/uploads/2019/07/panic-1393619_1280.png)

### [How to Find Locked Out Users in Active Directory with PowerShell](/find-locked-out-users-in-active-directory-powershell/)

See what we can do to find locked out users in Active Directory with PowerShell!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
