Skip to content

Instantly share code, notes, and snippets.

@stknohg
Created September 9, 2015 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stknohg/f4e650e0d10d9c257bd1 to your computer and use it in GitHub Desktop.
Save stknohg/f4e650e0d10d9c257bd1 to your computer and use it in GitHub Desktop.
ドメインコントローラーを降格させるスクリプト
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