# Active Directory – The directory service was unable to allocate a relative identifier

I’ve been testing Disaster Recovery scenario restoring Active Directory. One of the servers was restored, and it worked for a moment after restore. If you can regain your Primary DC, it’s best to do so. If you can’t, a standard thing to do during DR is to move all FSMO roles to the restored server so that it can become a master server. You can find out your FSMO holders by using those commands below:

blog

27 Mar 2019 pl

![Active Directory – The directory service was unable to allocate a relative identifier](/wp-content/uploads/2019/03/img_5c9bca841df28.png)

[Zobacz obrazy (5)](#pf-content-image-1-0)

I've been testing **Disaster Recovery** scenario restoring **Active Directory**. One of the servers was restored, and it worked for a moment after restore. If you can regain your **Primary DC**, it's best to do so. If you can't, a standard thing to do during **DR** is to move all **FSMO** roles to the restored server so that it can become a master server. You can find out your FSMO holders by using those commands below:

```powershell
Get-Adforest | Format-Table DomainNamingMaster, SchemaMaster

Get-ADDomain 'ad.evotec.xyz' | Format-Table InfrastructureMaster, PDCEmulator, RIDMaster
```

[!\[Wynik PowerShell z właścicielami ról FSMO, w tym RID Master\](/wp-content/uploads/2019/03/img_5c9bca841df28.png)](/wp-content/uploads/2019/03/img_5c9bca841df28.png)

If you're ready, you have confirmed where FSMO roles are stored you can do the force move. This can be done with a single PowerShell command as below.

```powershell
Move-ADDirectoryServerOperationMasterRole -Identity 'YourRestoredDC' -OperationMasterRole 0,1,2,3,4 -Force
```

Notice that I'm using **Force** switch. This switch should only be used in a case where you don't have access to your **FSMO** roles holder! And so I did.

### 💡 What's your problem?

Now the tricky part showed up when I wanted to create a new user for my test purposes. I was greeted with this nice little error message.

> Windows cannot create the object because The directory service was unable to allocate a relative identifier.

It was a bit unexpected because moving **FSMO** roles I've actually moved **RID Master** which should have allowed me to continue. But it didn't.

[!\[Komunikat Active Directory o braku możliwości przydzielenia identyfikatora względnego\](/wp-content/uploads/2019/03/img_5c9ab15539f10.png)](/wp-content/uploads/2019/03/img_5c9ab15539f10.png)

A quick check with **dcdiag **and indeed rID data seems to be corrupted.

```powershell
dcdiag /test:ridmanager /v
```

[!\[Wynik dcdiag /test:ridmanager wskazujący uszkodzone dane RID\](/wp-content/uploads/2019/03/img_5c9ab17e15b5e.png)](/wp-content/uploads/2019/03/img_5c9ab17e15b5e.png)

### 💡 What's my fix?

Actually, a fix to this is quite simple. I've actually planned to do that later on but it seems not doing so will prevent any changes You have to clean up your Active Directory from old, still down servers. Until you delete them and clean up their metadata it will not let you go any further. You just need to delete them from **Domain Controllers** in **Active Directory Users and Computers **as shown below.

[!\[Active Directory Users and Computers z wybranym starym kontrolerem domeny do usunięcia\](/wp-content/uploads/2019/03/img_5c9bcd68977f2.png)](/wp-content/uploads/2019/03/img_5c9bcd68977f2.png)

And finally, remove them from **Active Directory Sites and Services**. After that, you should be good to go and be able to create users again. Short but simple. Just make sure not to delete working servers, and definitely, **don't do it on production** unless you know what you're doing.

[!\[Active Directory Sites and Services z pozostałościami metadanych starego kontrolera domeny\](/wp-content/uploads/2019/03/img_5c9bcf5a22a1a.png)](/wp-content/uploads/2019/03/img_5c9bcf5a22a1a.png)

## Powiązane projekty

Projekty powiązane z tagami, kategoriami i treścią tego wpisu.

[Wszystkie projekty](/projekty/)

Trwa dopasowywanie projektów...

[Powrót do bloga](/blog/)

## Powiązane wpisy

- [Check an API write after a PowerShell timeout](/blog/verify-uncertain-api-outcomes-powershell/)
- [Inspect and convert mixed Office archives with PSWriteOffice](/blog/inspect-and-convert-mixed-office-archives-pswriteoffice/)
- [Compose PDF reports and automate page workflows with PSWriteOffice](/blog/automate-pdf-reports-and-page-workflows-pswriteoffice/)

<!-- PowerForge markdown artifact sha256:B321794C48C5C3A3C4AF182E2F099B7B8ECA352652D4EFC5E424A88FE318B6B7 -->
