Active Directory Backup

From SWKLS WIKI
Revision as of 17:43, 21 September 2020 by Unknown user (talk)
Jump to navigation Jump to search

AD Backup Notes

Find Role Holders

Get the list of domain controllers with FSMO roles using this command:

netdom query fsmo

Check last Backup

Check when the current Active Directory domain controller was backed up last time using the repadmin tool:

repadmin /showbackup

Get the backup status for all DCs in the domain using this command:

repadmin /showbackup *


Backing Up AD Domain Controller Using Windows Server Backup

Check / Install Server Backup

Check if Windows Server Backup is installed using the Get-WindowsFeature PowerShell cmdlet:

Get-WindowsFeature Windows-Server-Backup

If WSB is not installed, you can add it with PowerShell:

Add-Windowsfeature Windows-Server-Backup Includeallsubfeature

Powershell Backup Script

Back up a domain controller using PowerShell. To keep multiple levels of AD backup copies, we will store each backup copy in a separate directory with the date of backup creation as the folder name.

Import-Module ServerManager
[string]$date = get-date -f 'yyyy-MM-dd'
$path=\\mun-back1\backup\dc1\
$TargetUNC=$path+$date
$TestTargetUNC= Test-Path -Path $TargetUNC
if (!($TestTargetUNC)){
New-Item -Path $TargetUNC -ItemType directory
}
$WBadmin_cmd = "wbadmin.exe START BACKUP -backupTarget:$TargetUNC -systemState -noverify -vssCopy -quiet"
Invoke-Expression $WBadmin_cmd

Category:SWKLS Tech