diff --git a/scripts/Windows/Scripts/System.ps1 b/scripts/Windows/Scripts/System.ps1 index 33b473b4..952b96c1 100644 --- a/scripts/Windows/Scripts/System.ps1 +++ b/scripts/Windows/Scripts/System.ps1 @@ -6,3 +6,26 @@ function New-TemporaryDirectory { $path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName()); New-Item -ItemType Directory $path; } + +<# + .SYNOPSIS + Removes desktop icons which apply to the specified pattern. + + .PARAMETER Pattern + The pattern to match the icons to delete. +#> +function Remove-DesktopIcon { + param( + [string] $Pattern + ) + + $path = "Desktop/$Pattern"; + + foreach ($userDir in @($(~), $env:PUBLIC, "$env:SystemDrive/Users/Default")) { + $fullName = "$userDir/$path"; + + if (Test-Path -PathType Leaf $fullName) { + Remove-Item $fullName; + } + } +} diff --git a/scripts/Windows/Software/Windows/Manage.ps1 b/scripts/Windows/Software/Windows/Manage.ps1 index a90b281a..d2866e07 100644 --- a/scripts/Windows/Software/Windows/Manage.ps1 +++ b/scripts/Windows/Software/Windows/Manage.ps1 @@ -66,6 +66,8 @@ Start-SoftwareInstaller @PSBoundParameters ` $startLayoutFile = "start.json"; Write-Host "Removing adware"; + Remove-DesktopIcon "*Microsoft Edge*"; + Edit-DefaultUserKey { param ( [RegistryKey] $Key