Refactor ad removal
This commit is contained in:
parent
d537ba87a5
commit
70a757cdcb
1 changed files with 7 additions and 4 deletions
|
@ -30,9 +30,10 @@ $context.ProcessDefaultUserKey($action);
|
||||||
Write-Information "Remove ads from pinned apps";
|
Write-Information "Remove ads from pinned apps";
|
||||||
Export-StartLayout $startLayoutFile;
|
Export-StartLayout $startLayoutFile;
|
||||||
|
|
||||||
$startLayout = Get-Content "$startLayoutFile" | ConvertFrom-Json;
|
$startLayout = Get-Content "$startLayoutFile" | ConvertFrom-Json
|
||||||
|
$originalProperty = "pinnedList";
|
||||||
|
|
||||||
$startLayout.pinnedList = $startLayout.pinnedList | Where-Object {
|
$newLayout = $startLayout[$originalProperty] | Where-Object {
|
||||||
return -not (
|
return -not (
|
||||||
($_.desktopAppLink -like "*Microsoft Edge*") -or
|
($_.desktopAppLink -like "*Microsoft Edge*") -or
|
||||||
[System.Linq.Enumerable]::Any(
|
[System.Linq.Enumerable]::Any(
|
||||||
|
@ -52,8 +53,10 @@ $startLayout.pinnedList = $startLayout.pinnedList | Where-Object {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
$startLayout | ConvertTo-Json -Compress | Set-Content $startLayoutFile;
|
$startLayout.PSObject.Properties.Remove($originalProperty);
|
||||||
Import-StartLayout $startLayoutFile "$env:SystemDrive";
|
$startLayout | Add-Member -NotePropertyName "primaryOEMPins" -NotePropertyValue $newLayout;
|
||||||
|
|
||||||
|
$startLayout | ConvertTo-Json -Compress | Set-Content "$env:SystemDrive\Users\Default\AppData\Local\Microsoft\Windows\Shell";
|
||||||
|
|
||||||
Pop-Location;
|
Pop-Location;
|
||||||
Remove-Item -Recurse "$tempDir";
|
Remove-Item -Recurse "$tempDir";
|
||||||
|
|
Loading…
Reference in a new issue