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";
|
||||
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 (
|
||||
($_.desktopAppLink -like "*Microsoft Edge*") -or
|
||||
[System.Linq.Enumerable]::Any(
|
||||
|
@ -52,8 +53,10 @@ $startLayout.pinnedList = $startLayout.pinnedList | Where-Object {
|
|||
}));
|
||||
}
|
||||
|
||||
$startLayout | ConvertTo-Json -Compress | Set-Content $startLayoutFile;
|
||||
Import-StartLayout $startLayoutFile "$env:SystemDrive";
|
||||
$startLayout.PSObject.Properties.Remove($originalProperty);
|
||||
$startLayout | Add-Member -NotePropertyName "primaryOEMPins" -NotePropertyValue $newLayout;
|
||||
|
||||
$startLayout | ConvertTo-Json -Compress | Set-Content "$env:SystemDrive\Users\Default\AppData\Local\Microsoft\Windows\Shell";
|
||||
|
||||
Pop-Location;
|
||||
Remove-Item -Recurse "$tempDir";
|
||||
|
|
Loading…
Reference in a new issue