question

witchkinkofangmar-6814 avatar image
0 Votes"
witchkinkofangmar-6814 asked

Adding a machine to a domain fails with internal error

I've enabled SMBv1 and completed updates first as troubleshooting but I still get the error.
The error I get is:

Add-Computer: Computer "server2019' failed to join domain 'dev.domain.com' from its current workgroup 'WORKGROUP' with following error message: An internal error occurred.
At line:1 char:1
Add-Computer -DomainName dev.domain.com -OUPath "OU=$OU,dc=dev,dc=domain,dc=com" ...

CategorvInfo :Operation5topped: (server2019:5tring) [Add-Computer]
. InvalidoperationException
+ FullvOualifiedErrorId:FailToJoinDomainFromworkgroup,Microsoft.PowerShell.Commands.AddComputerCommand

Here is the part of my script that does the join:

 param (
     [String]$OU,
     [PSCredential]$Credential
     )
    
 $ErrorActionPreference="SilentlyContinue"
 Stop-Transcript | out-null
 $ErrorActionPreference = "Continue"
    
    
 if ([Environment]::UserInteractive) {
     if (!$OU) { $OU = Read-Host "Enter Resource Pool Name (exactly as appears in vCenter inventory)" }
     if (!$Credential) { $Credential = Get-Credential -Message "Enter dev domain credentials" }
 }
    
 # Add Computer to Dev domain
    
 try {
     Add-Computer -DomainName dev.domain.com -OUPath "OU=$OU,dc=dev,dc=domain,dc=com" -ErrorAction stop -Credential $Credential
     }
 catch {
     Write-Warning "Failed to join to domain."
         Read-Host -Prompt "Press Enter to exit"
     Throw $_
     }








windows-server-powershellwindows-server-2019windows-server-2016
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers