Windows 2012–Uninstalling AD DS services (demoting GC)–copied Powershell script from the setup
#
# Windows PowerShell script for AD DS Deployment
#
Import-Module ADDSDeployment
Uninstall-ADDSDomainController `
-DemoteOperationMasterRole:$true `
-IgnoreLastDnsServerForZone:$true `
-LastDomainControllerInDomain:$true `
-RemoveApplicationPartitions:$true `
-Force:$true