81 lines
3.1 KiB
PowerShell
81 lines
3.1 KiB
PowerShell
#!/bin/pwsh
|
|
param($context)
|
|
|
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
|
|
|
[Context] $context = $context;
|
|
$tempDir = $context.GetTempDirectory();
|
|
$startLayoutFile = "start.json";
|
|
Push-Location "$tempDir";
|
|
|
|
Write-Information "Remove MSEdge Icon";
|
|
$context.RemoveDesktopIcon("Microsoft Edge*");
|
|
|
|
Write-Host "Configuring Windows";
|
|
Write-Information "Set old-school icon size";
|
|
|
|
$action = {
|
|
param([Microsoft.Win32.RegistryKey] $userKey)
|
|
|
|
$spacingProperty = "IconSpacing";
|
|
$relativeKeyPath = "Control Panel\Desktop\WindowMetrics"
|
|
$keyPath = "$($userKey.PSPath)\$relativeKeyPath";
|
|
Copy-ItemProperty "HKCU:\$relativeKeyPath" "$keyPath" "$spacingProperty";
|
|
Rename-ItemProperty $keyPath $spacingProperty "_$spacingProperty";
|
|
Set-ItemProperty $keyPath -Name $spacingProperty -Value "-1710" -Type "String";
|
|
|
|
Write-Information "Disabling adware";
|
|
$winKey = "$($userKey.PSPath)\Software\Microsoft\Windows\CurrentVersion";
|
|
$contentDeliveryKey = "$winKey\ContentDeliveryManager";
|
|
$cloudContentKey = "HKLM:\Software\Policies\Microsoft\Windows\CloudContent";
|
|
|
|
foreach ($key in @($contentDeliveryKey, $cloudContentKey)) {
|
|
if (-not (Test-Path $key)) {
|
|
$null = New-Item $key;
|
|
}
|
|
}
|
|
|
|
Set-ItemProperty "$cloudContentKey" -Name "DisableWindowsConsumerFeatures" -Value 1 -Type "DWord";
|
|
Set-ItemProperty "$cloudContentKey" -Name "DisableCloudOptimizedContent" -Value 1 -Type "DWord";
|
|
Set-ItemProperty "$cloudContentKey" -Name "DisableConsumerAccountStateContent" -Value 1 -Type "DWord";
|
|
Set-ItemProperty "$winKey\Explorer\Advanced" -Name "TaskBarMn" -Value 0 -Type "DWord";
|
|
Set-ItemProperty "$contentDeliveryKey" -Name "ContentDeliveryAllowed" -Value 0 -Type "DWord";
|
|
Set-ItemProperty "$contentDeliveryKey" -Name "SilentInstalledAppsEnabled" -Value 0 -Type "DWord";
|
|
Set-ItemProperty "$contentDeliveryKey" -Name "SystemPaneSuggestionsEnabled" -Value 0 -Type "DWord";
|
|
}
|
|
|
|
$context.ProcessDefaultUserKey($action);
|
|
|
|
Write-Information "Remove ads from pinned apps";
|
|
Export-StartLayout $startLayoutFile;
|
|
|
|
$startLayout = Get-Content "$startLayoutFile" | ConvertFrom-Json
|
|
$originalProperty = "pinnedList";
|
|
|
|
$newLayout = $startLayout | Select-Object -ExpandProperty $originalProperty | Where-Object {
|
|
return -not (
|
|
($_.desktopAppLink -like "*Microsoft Edge*") -or
|
|
[System.Linq.Enumerable]::Any(
|
|
@(
|
|
"*MicrosoftOfficeHub*",
|
|
"*SpotifyMusic*",
|
|
"*WhatsApp*",
|
|
"*PrimeVideo*",
|
|
"*Netflix*",
|
|
"*Instagram*",
|
|
"*Clipchamp*",
|
|
"*Facebook*",
|
|
"*LinkedIn*"),
|
|
[System.Func[System.Object,bool]]{
|
|
param($pattern)
|
|
return $_.packagedAppId -like "$pattern";
|
|
}));
|
|
}
|
|
|
|
$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\LayoutModification.json";
|
|
|
|
Pop-Location;
|
|
Remove-Item -Recurse "$tempDir";
|