Make Thunderbird the default mail program

This commit is contained in:
Manuel Thalmann 2023-07-24 23:54:05 +02:00
parent 2ad0149950
commit 87d99f8ede
2 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,38 @@
#!/bin/pwsh
param($context)
. "$PSScriptRoot/../../Scripts/Context.ps1";
[Context] $context = $context;
$tempDir = $context.GetTempDirectory();
Push-Location $tempDir;
$configFile = "$tempDir/DefaultAssociations.xml";
Write-Information "Making Thunderbird the default Mail program";
DISM /Online "/Export-DefaultAppAssociations:$configFile";
[xml]$defaultAssociations = [xml]::new();
$defaultAssociations.PreserveWhitespace = $true;
$reader = [System.Xml.XmlReader]::Create("$configFile", $readerSettings);
$defaultAssociations.Load($reader);
$reader.Dispose();
foreach ($association in $defaultAssociations.SelectNodes("/DefaultAssociations/Association")) {
$association.ApplicationName = "Thunderbird";
switch ($association.Identifier) {
"mailto" {
$association.ProgId = "Thunderbird.Url.mailto";
};
".eml" {
$association.ProgId = "ThunderbirdEML";
};
}
}
$defaultAssociations.Save($configFile);
DISM /Online "/Import-DefaultAppAssociations:$configFile";
Pop-Location;
Remove-Item -Recurse $tempDir;

View file

@ -5,3 +5,4 @@ param($context)
[Context] $context = $context;
choco install -y thunderbird;
. "$PSScriptRoot/../../Config/Thunderbird/Install.ps1" $context;