Active Directory Lightweight Directory Services – Backup

Backing up AD LDS is similar to backing up Active Directory: either take a backup of the System State via Windows Server Backup, or via the command line AD LDS utility dsdbutil.exe.

To back up an AD LDS instance via PowerShell, call dsdbutil with the required parameters. Also note that the folder that dsdbutil is saving the backup to must be empty of all files and subfolders.

$InstanceName = $args[0]
if($InstanceName -eq $null){exit}
$BackupRoot = "C:\backup"
ri $BackupRoot\$InstanceName\* -Confirm:$false -Recurse
dsdbutil "Activate Instance $InstanceName" ifm "Create Full $BackupRoot\$InstanceName" quit quit

This script can be run via ADLDSBackup.ps1 InstanceName. A backup will be placed in C:\backup\InstanceName\adamntds.dit.

Trevor Seward is a Microsoft Office Apps and Services MVP who specializes in SharePoint Server administration, hybrid scenarios, and SharePoint Online. He has been working with SharePoint for 16 years from SharePoint 2003 on up, managing environments with terabytes of content for 150,000+ user organizations. Trevor is an author of Deploying SharePoint 2016 and Deploying SharePoint 2019. You can find him on Twitter and in /r/sharepoint.