Active Directory Backup: Difference between revisions

From SWKLS WIKI
Jump to navigation Jump to search
(Created page with "=AD Backup Notes= ==Find Role Holders== Get the list of domain controllers with FSMO roles using this command: netdom query fsmo Category:Active Directory Category:W...")
 
No edit summary
Line 3: Line 3:
Get the list of domain controllers with FSMO roles using this command:
Get the list of domain controllers with FSMO roles using this command:


<syntaxhighlight lang="powershell">
netdom query fsmo
netdom query fsmo
</syntaxhighlight>
==Check last Backup==
Check when the current Active Directory domain controller was backed up last time using the repadmin tool:
<syntaxhighlight lang="powershell">
repadmin /showbackup
</syntaxhighlight>
Get the backup status for all DCs in the domain using this command:
<syntaxhighlight lang="powershell">
repadmin /showbackup *
</syntaxhighlight>
==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:
<syntaxhighlight lang="powershell">
Get-WindowsFeature Windows-Server-Backup
</syntaxhighlight>
If WSB is not installed, you can add it with PowerShell:
<syntaxhighlight lang="powershell">
Add-Windowsfeature Windows-Server-Backup –Includeallsubfeature
</syntaxhighlight>
===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.
<syntaxhighlight lang="powershell">
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
</syntaxhighlight>





Revision as of 17:43, 21 September 2020

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