38 lines
1.1 KiB
PowerShell
38 lines
1.1 KiB
PowerShell
#!/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;
|