2023-07-17 14:02:33 +00:00
|
|
|
#!/bin/pwsh
|
|
|
|
param($context)
|
2023-07-18 19:19:49 +00:00
|
|
|
|
|
|
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
|
|
|
|
|
|
|
[Context] $context = $context;
|
|
|
|
$tempDir = $context.GetTempDirectory();
|
|
|
|
$startLayoutFile = "start.json";
|
|
|
|
Push-Location "$tempDir";
|
|
|
|
|
|
|
|
Write-Information "Remove MSEdge Icon";
|
2023-07-18 20:27:32 +00:00
|
|
|
$context.RemoveDesktopIcon("Microsoft Edge*");
|
2023-07-18 19:19:49 +00:00
|
|
|
|
2023-07-17 14:02:33 +00:00
|
|
|
Write-Host "Configuring Windows";
|
2023-07-18 19:19:49 +00:00
|
|
|
Write-Information "Set old-school icon size";
|
2023-07-17 14:02:33 +00:00
|
|
|
|
|
|
|
$action = {
|
|
|
|
param([Microsoft.Win32.RegistryKey] $userKey)
|
|
|
|
|
|
|
|
$spacingProperty = "IconSpacing";
|
2023-07-17 14:12:26 +00:00
|
|
|
$relativeKeyPath = "Control Panel\Desktop\WindowMetrics"
|
|
|
|
$keyPath = "$($userKey.PSPath)\$relativeKeyPath";
|
|
|
|
Copy-ItemProperty "HKCU:\$relativeKeyPath" "$keyPath" "$spacingProperty";
|
2023-07-17 14:02:33 +00:00
|
|
|
Rename-ItemProperty $keyPath $spacingProperty "_$spacingProperty";
|
|
|
|
Set-ItemProperty $keyPath -Name $spacingProperty -Value "-1710" -Type "String";
|
|
|
|
}
|
|
|
|
|
|
|
|
$context.ProcessDefaultUserKey($action);
|
2023-07-18 19:19:49 +00:00
|
|
|
|
|
|
|
Write-Information "Remove ads from pinned apps";
|
|
|
|
Export-StartLayout $startLayoutFile;
|
|
|
|
|
2023-07-18 21:46:03 +00:00
|
|
|
$startLayout = Get-Content "$startLayoutFile" | ConvertFrom-Json
|
|
|
|
$originalProperty = "pinnedList";
|
2023-07-18 19:19:49 +00:00
|
|
|
|
2023-07-18 21:46:03 +00:00
|
|
|
$newLayout = $startLayout[$originalProperty] | Where-Object {
|
2023-07-18 19:19:49 +00:00
|
|
|
return -not (
|
|
|
|
($_.desktopAppLink -like "*Microsoft Edge*") -or
|
|
|
|
[System.Linq.Enumerable]::Any(
|
|
|
|
@(
|
|
|
|
"*MicrosoftOfficeHub*",
|
|
|
|
"*SpotifyMusic*",
|
|
|
|
"*WhatsApp*",
|
|
|
|
"*PrimeVideo*",
|
|
|
|
"*Netflix*",
|
|
|
|
"*Instagram*",
|
|
|
|
"*Clipchamp*",
|
2023-07-18 20:30:19 +00:00
|
|
|
"*Facebook*",
|
|
|
|
"*LinkedIn*"),
|
2023-07-18 19:19:49 +00:00
|
|
|
[System.Func[System.Object,bool]]{
|
|
|
|
param($pattern)
|
|
|
|
return $_.packagedAppId -like "$pattern";
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2023-07-18 21:46:03 +00:00
|
|
|
$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";
|
2023-07-18 19:19:49 +00:00
|
|
|
|
|
|
|
Pop-Location;
|
|
|
|
Remove-Item -Recurse "$tempDir";
|