Make Thunderbird the default mail program
This commit is contained in:
parent
2ad0149950
commit
87d99f8ede
2 changed files with 39 additions and 0 deletions
38
scripts/Windows/Config/Thunderbird/Install.ps1
Normal file
38
scripts/Windows/Config/Thunderbird/Install.ps1
Normal 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;
|
|
@ -5,3 +5,4 @@ param($context)
|
||||||
[Context] $context = $context;
|
[Context] $context = $context;
|
||||||
|
|
||||||
choco install -y thunderbird;
|
choco install -y thunderbird;
|
||||||
|
. "$PSScriptRoot/../../Config/Thunderbird/Install.ps1" $context;
|
||||||
|
|
Loading…
Reference in a new issue