Add a function for removing desktop icons
This commit is contained in:
parent
6268eab1e5
commit
348b1a00bc
|
@ -6,3 +6,26 @@ function New-TemporaryDirectory {
|
||||||
$path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName());
|
$path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName());
|
||||||
New-Item -ItemType Directory $path;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -66,6 +66,8 @@ Start-SoftwareInstaller @PSBoundParameters `
|
||||||
$startLayoutFile = "start.json";
|
$startLayoutFile = "start.json";
|
||||||
Write-Host "Removing adware";
|
Write-Host "Removing adware";
|
||||||
|
|
||||||
|
Remove-DesktopIcon "*Microsoft Edge*";
|
||||||
|
|
||||||
Edit-DefaultUserKey {
|
Edit-DefaultUserKey {
|
||||||
param (
|
param (
|
||||||
[RegistryKey] $Key
|
[RegistryKey] $Key
|
||||||
|
|
Loading…
Reference in a new issue