Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ドメインコントローラーを降格させるスクリプト
Import-Module ADDSDeployment
# Demote domain controller
$DomainName = "contoso.local"
$Cred = New-Object PSCredential "administrator@$DomainName",(ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force)
$Params = @{
LocalAdministratorPassword = (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force);
DemoteOperationMasterRole = $true;
RemoveDnsDelegation = $true;
DnsDelegationRemovalCredential = $Cred;
Confirm = $false;
}
Uninstall-ADDSDomainController @Params
# Remove DNS
Remove-WindowsFeature DNS, RSAT-DNS-Server
# Remove ADDS
Remove-WindowsFeature AD-Domain-Services, GPMC, RSAT-ADDS, RSAT-AD-PowerShell
# Reboot
Restart-Computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.