Quick guide:
How to demote domain controller by Powershell commands:
The first step is to import module:
import-module ActiveDirectory
Uninstall -ADDSDomainController -ForceRemoval -DemoteOperationMasterRole
We have to confirm with Y and then the server will perform restart automatically