У меня запущены следующие скрипты.
Как правило, оба сценария создают файлы во время выполнения, а затем сервер перезапускает и запускает вновь созданные файлы, однако при присоединении дочернего контроллера домена к лесу возникает ошибка, даже если она успешно подключается.
Лесной округ Колумбия
$path = [Environment]::GetFolderPath("Desktop") + "\AddForest.ps1"
New-Item $path -ItemType File
Set-Content -Path $path -Value @'
Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools
Install-ADDSForest `
-CreateDnsDelegation:$false `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "WinThreshold" `
-DomainName "electric-petrol.ie" `
-DomainNetbiosName "ELECTRIC-PETROL" `
-ForestMode "WinThreshold" `
-InstallDns:$true `
-LogPath "C:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "C:\Windows\SYSVOL" `
-Force:$true `
-SafeModeAdministratorPassword (ConvertTo-SecureString -String 'Passw0rd' -Force -AsPlainText)
$pathb = [Environment]::GetFolderPath("Desktop") + "\RestartNetworkServices.ps1"
Remove-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "AddForest"
Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "RestartNetworkServices" -Value "powershell.exe $pathb"
write-host "deleting used files.."
$path = [Environment]::GetFolderPath("Desktop") + "\AddForest.ps1"
Remove-Item -Path $path -Force
restart-computer
'@
$pathb = [Environment]::GetFolderPath("Desktop") + "\RestartNetworkServices.ps1"
New-Item $pathb -ItemType File
Set-Content -Path $pathb -Value @'
Restart-Service -Name NlaSvc -force
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Remove-ItemProperty $RegPath -Name "AutoAdminLogon"
Remove-ItemProperty $RegPath -Name "DefaultUsername"
Remove-ItemProperty $RegPath -Name "DefaultPassword"
Remove-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "RestartNetworkServices"
write-host "deleting used files.."
$pathb = [Environment]::GetFolderPath("Desktop") + "\RestartNetworkServices.ps1"
Remove-Item -Path $pathb -Force
'@
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1"
Set-ItemProperty $RegPath "DefaultUsername" -Value "Administrator" -type String
Set-ItemProperty $RegPath "DefaultPassword" -Value "Passw0rd" -type String
Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "AddForest" -Value "powershell.exe $path"
write-host "deleting used files.."
$pathd = [Environment]::GetFolderPath("Desktop") + "\Abbeydorney_DC1.ps1"
Remove-Item -Path $pathd -Force
restart-computer
Детский округ Колумбия
$patha = [Environment]::GetFolderPath("Desktop") + "\JoinDomain.ps1"
New-Item $patha -ItemType File
Set-Content -Path $patha -Value @'
$srvr = "AbbeydorneyDC2"
$domname = "electric-petrol.ie"
$dom = ($domname).Remove(15,3)
$pass = convertto-securestring -string "Passw0rd" -asplaintext -force
$cred = New-Object System.Management.Automation.PSCredential -argumentlist ("$dom\Administrator", $pass)
add-computer -domainname $domname -Credential $cred
Remove-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "JoinDomain"
$pathb = [Environment]::GetFolderPath("Desktop") + "\JoinForest.ps1"
Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "JoinForest" -Value "powershell.exe $pathb"
write-host "deleting used files.."
$pathc = [Environment]::GetFolderPath("Desktop") + "\JoinDomain.ps1"
Remove-Item -Path $pathc -Force
restart-computer
'@
$pathc = [Environment]::GetFolderPath("Desktop") + "\JoinForest.ps1"
New-Item $pathc -ItemType File
Set-Content -Path $pathc -Value @'
$srvr = "AbbeydorneyDC2"
$domname = "electric-petrol.ie"
$dom = ($domname).Remove(15,3)
$pass = convertto-securestring -string "Passw0rd" -asplaintext -force
$cred = New-Object System.Management.Automation.PSCredential -argumentlist ("$dom\Administrator", $pass)
Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools
Install-ADDSDomain `
-credential $cred `
-CreateDnsDelegation:$true `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "WinThreshold" `
-NewDomainName "Abbeydorney" `
-ParentDomainName $domname `
-InstallDns:$true `
-LogPath "C:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "C:\Windows\SYSVOL" `
-safemodeadministratorpassword $pass `
-Force:$true
Install-WindowsFeature -Name 'DHCP' –IncludeManagementTools
Remove-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "JoinForest"
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Remove-ItemProperty $RegPath -Name "AutoAdminLogon"
Remove-ItemProperty $RegPath -Name "DefaultUsername"
Remove-ItemProperty $RegPath -Name "DefaultPassword"
write-host "deleting used files.."
$pathc = [Environment]::GetFolderPath("Desktop") + "\JoinForest.ps1"
Remove-Item -Path $pathc -Force
restart-computer
'@
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1"
Set-ItemProperty $RegPath "DefaultUsername" -Value "Administrator" -type String
Set-ItemProperty $RegPath "DefaultPassword" -Value "Passw0rd" -type String
Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "JoinDomain" -Value "powershell.exe $patha"
write-host "deleting used files.."
$pathd = [Environment]::GetFolderPath("Desktop") + "\Abbeydorney_DC2.ps1"
Remove-Item -Path $pathd -Force
restart-computer
Ошибка (даже при том, что дочерний DC успешно присоединяется к Forest)
At C:\Users\Administrator\Desktop\JoinForest.ps1:9 char:1
+ Install-ADDSDomain -credential $cred -CreateDnsDelegation:$true -Data ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-ADDSDomain], TestFailedException
+ FullyQualifiedErrorId : Test.VerifyDcPromoCore.DCPromo.General.77,Microsoft.DirectoryServices.Deployment.PowerShell.Commands.InstallADDSDomainCommand
Message : Verification of prerequisites for Domain Controller promotion failed. The specified argument 'ChildName' was not recognized.
Context : Test.VerifyDcPromoCore.DCPromo.General.77
RebootRequired : False
Status : Error
Любые мысли о том, что вызывает ошибку.