I mean when I write the OU path directly into the software component and didn't take the variable it works without any error.
So instead of:
Write-Output New-ADOrganizationalUnit -Name ""$createOUName"" -Path ""$CreateOUPath"" -ProtectedFromAccidentalDeletion $false -Credential $ADcredential -Server $domainController -ErrorAction Ignore
I'll fill $CreateOUPath:
Write-Output New-ADOrganizationalUnit -Name ""$createOUName"" -Path ""OU=TEST,dc=test1,dc=test,dc=intern"" -ProtectedFromAccidentalDeletion $false -Credential $ADcredential -Server $domainController -ErrorAction Ignore
The first one creates OU and later join VM to domain but throw the mentioned exit error=1.
The second one works like a charm and complete deployment finished successfully.
Can it be a bug?