Want to roll back any Active Directory change with a PowerShell one-liner? We’ve just published an online reference to the cmdlets shipped with Quest Recovery manager for Active Directory.
These cmdlets use backups so they are not limited to tombstone reanimation (as regular cmdlets).
For example, if you restore a user you get all the attributes including group membership and so on.
So to restore a deleted object you simply call Restore-RMDeletedActiveDirectoryObject
and have the tool handle everything.
However, what makes it way more cool is that you have full power to restore any attributes of any users. So you are not limited to just undeleting stuff. Let’s say you had some kind of script/tool go wild and corrupt an attribute or two across all user accounts. Good luck restoring just these 2 attributes manually or with any kind of UI tool.
With these cmdlets it is as easy as:
# Select the backup you want - e.g. the latest
$b = (Get-RMBackup –Domain dom1.local | Sort-Object –Property Date)[-1]
# For every user in AD restore extensionattribute1
Get-QADUser | foreach {
Restore-RMActiveDirectoryObject –Backup $b.Path –Object $_.DN –Attribute extensionattribute1
}
Is it cool or what? 😉
Here’s the full list of cmdlets linked to the help info for each of them:
- Compare-RMActiveDirectoryObject
- Restore-RMActiveDirectoryObject
- Get-RMDeletedActiveDirectoryObject
- Restore-RMDeletedActiveDirectoryObject
Note that unlike AD cmdlets these are actually a part of commercial product so there is cost involved. You can get a trial license from the product page. If you are a Microsoft MVP you can also get a free NFR license by applying here.
(Get-RMDeletedActiveDirectoryObject dc1.dom1.lab.local) | Where-Object { $_.Properties["objectclass"] –contains "user" } C:\PS>foreach ($u in $users) { Restore-RMDeletedActiveDirectoryObject –Name $u.Properties["name"] –DirectoryHost dc1.dom1.lab.local }
Tags: AD, Active Directory, Examples, PowerShell, Quest Software, cmdlets, one-liner, MVP