There is a GlobalSign CA. In most cases its root certificate is already exists in the Windows Certificates storage.
But sometimes (especially on old Windows versions) the storage doesn't contain the certificate.

I need to check if the certificate exists and import it if does not. I exported the certificate to a file and imported it using the code below:

```
public void ImportCertificate(StoreName storeName,
    StoreLocation location,
    byte[] certificateData)
{
    X509Store x509Store = new X509Store(storeName, location);
    X509Certificate2 certificate = new X509Certificate2(certificateData);
    x509Store.Open(OpenFlags.ReadWrite);
    x509Store.Add(certificate);
    x509Store.Close();
}

```

The code adds the certificate but all certificate purposes are checked:

[![Result](https://i.stack.imgur.com/NfPuo.png)](https://i.stack.imgur.com/NfPuo.png)

I don't want to add extra purposes to the certificate just want to set those ones which have other root CAs like below:

[![Expect](https://i.stack.imgur.com/tAXRR.png)](https://i.stack.imgur.com/tAXRR.png)

How to do it programatically?
['https://Stackoverflow.com/questions/53867961', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4675884/']
DEPRECATED: As mentioned on this answer ([How can I run commands in a running container in AWS ECS using Fargate](https://stackoverflow.com/questions/51570928/how-can-i-run-commands-in-a-running-container-in-aws-ecs-using-fargate)) you cannot do it due to the fact AWS doesn't give you access to the underlying infrastructure.

UPDATE: Pierre below mentions an announcement from AWS allowing to do just that.
You may be able to script your container to execute a cli command, but you cannot ssh into the container though. 
If you can invoke a `.sh` file from the `CMD` command in the Dockerfile, the cli command will get executed as long as you have aws-cli installed on the docker image.

In the Dockerfile make sure to run `pip3 install awscli --upgrade --user` before you invoke your script that contains cli commands.

As an alternative, you can use [boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html) for Python or the [AWS SDK for JavaScript](https://docs.amazonaws.cn/AWSJavaScriptSDK/latest/), which both have comprehensive documentation and enable you to run all the commands you could have run via cli