Update AWS.DomainJoin.exe.config to resolve unhandled exception on Windows domain join#630
Update AWS.DomainJoin.exe.config to resolve unhandled exception on Windows domain join#630burck1 wants to merge 1 commit intoaws:mainlinefrom
Conversation
|
Hi @Aperocky, @gianniLesl, @rhaoran-aws, @andrei-a2, @bryantbiggs. Apologies, just tagging a few recent contributors to this repo. Can you point me to the right person to get this PR reviewed and merged? Is there anything you need from me to proceed? |
|
Thanks @burck1 for submitting this PR Could you please share on which SSM Agent version and OS version you were facing this issue? Steps to reproduce would be even better |
|
Hi Haoran. We have seen this issue occur on all of the latest
We think we have narrowed this issue down to occuring only when our our antivirus solution is installed before attempting to domain join the instance. We use a tool called Carbon Black Cloud. We have observed that if we launch the latest windows server AMI, install Carbon Black, reboot, then attempt to run the Unfortunately we cannot provide you with the MSI installer for Carbon Black and they do not provide a public download for the MSI, so it may be difficult for you to re-create the issue unless you have access to a Carbon Black Cloud account. We've created a temporary workaround for the issue. We build custom AMIs, so we now run the following PowerShell script during our AMI build process to apply the change in this PR in our custom AMIs: $configPath = Join-Path $env:ProgramFiles 'Amazon\SSM\Plugins\awsDomainJoin\AWS.DomainJoin.exe.config'
if (-not (Test-Path $configPath))
{
throw 'AWS.DomainJoin.exe.config not found'
}
Write-Host 'Reading AWS.DomainJoin.exe.config'
$config = Get-Content $configPath -Raw
$findString = '<startup>'
$replacementString = '<startup useLegacyV2RuntimeActivationPolicy="true">'
if ($config.Contains($replacementString))
{
Write-Host 'AWS.DomainJoin.exe.config is already updated. Skipping...'
return
}
if (-not $config.Contains($findString))
{
throw "$findString not found in AWS.DomainJoin.exe.config"
}
$updatedConfig = $config.Replace($findString, $replacementString)
Write-Host 'Updating AWS.DomainJoin.exe.config'
Set-Content $configPath -Value $updatedConfig -Encoding 'UTF8' -NoNewline -Force
Write-Host 'Updated AWS.DomainJoin.exe.config' |
|
Hi @rhaoran-aws. Do you have any questions for me? Is there anything you need from me to get this update merged? |
Description of changes:
This update resolves an error we are seeing when attempting to join a Windows EC2 instance to our Active Directory domain.
The error can be seen when running the
AWS-JoinDirectoryServiceDomainorAWS-JoinDirectoryServiceDomain-V2documents, or when running a custom document that uses the aws:domainJoin action.The
stderroutput isAdditionally, the error can be replicated by running the
AWS.DomainJoin.exedirectly.The solution to add
useLegacyV2RuntimeActivationPolicy="true"was recommended in this stack overflow post and confirmed in the documentation.Additionally, I have tested the solution by updating the
AWS.DomainJoin.exe.configfile to include theuseLegacyV2RuntimeActivationPolicy="true"property and then re-running the exe and SSM document.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.