#For use to install Active Directory on a server, new forest or join existing domain # 5/17/2022: Version 1.0 Initial setups #New Active Directory setup Install-WindowsFeature AD-Domain-Services -IncludeManagementTools Install-ADDSForest -DomainName domainname.local -InstallDNS #Add Server to existing AD Forest/domain Install-WindowsFeature AD-Domain-Services -IncludeManagementTools Install-ADDSDomainController -CreateDnsDelegation:$false -InstallDns:$true -DomainName "domain.local" -SiteName "Default-First-Site-Name" -DatabasePath "C:\Windows\NTDS" -LogPath "C:\Windows\NTDS" -SysvolPath "C:\Windows\SYSVOL" -Force:$true -Credential (Get-Credential) #Enable AD Recycle Bin if not already enabled Enable-ADOptionalFeature 'Recycle Bin Feature' -Scope ForestOrConfigurationSet -Target domainname.local #FSMO Migration # 0 - PDCEmulator # 1 - RIDMaster # 2 - InfrastructureMaster # 3 - SchemaMaster # 4 - DomainNamingMaster Import-module ActiveDirectory Move-ADDirectoryServerOperationMasterRole -Identity "Target-DC" -OperationMasterRole 0,1,2,3,4 netdom query fsmo