Ensure keys for accessing adware options exist
This commit is contained in:
parent
dffb937078
commit
1505cd3e94
1 changed files with 15 additions and 6 deletions
|
@ -23,6 +23,21 @@ $action = {
|
||||||
Copy-ItemProperty "HKCU:\$relativeKeyPath" "$keyPath" "$spacingProperty";
|
Copy-ItemProperty "HKCU:\$relativeKeyPath" "$keyPath" "$spacingProperty";
|
||||||
Rename-ItemProperty $keyPath $spacingProperty "_$spacingProperty";
|
Rename-ItemProperty $keyPath $spacingProperty "_$spacingProperty";
|
||||||
Set-ItemProperty $keyPath -Name $spacingProperty -Value "-1710" -Type "String";
|
Set-ItemProperty $keyPath -Name $spacingProperty -Value "-1710" -Type "String";
|
||||||
|
|
||||||
|
Write-Information "Disabling adware";
|
||||||
|
$contentDeliveryKey = "$($userKey.PSPath)\Software\Microsoft\Windows\CurrentVersion\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 "$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);
|
$context.ProcessDefaultUserKey($action);
|
||||||
|
@ -58,11 +73,5 @@ $startLayout | Add-Member -NotePropertyName "primaryOEMPins" -NotePropertyValue
|
||||||
|
|
||||||
$startLayout | ConvertTo-Json -Compress | Set-Content "$env:SystemDrive\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.json";
|
$startLayout | ConvertTo-Json -Compress | Set-Content "$env:SystemDrive\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.json";
|
||||||
|
|
||||||
$contentDeliveryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager";
|
|
||||||
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Value 1 -Type "DWord";
|
|
||||||
Set-ItemProperty "$contentDeliveryPath" -Name "ContentDeliveryAllowed" -Value 0 -Type "DWord";
|
|
||||||
Set-ItemProperty "$contentDeliveryPath" -Name "SilentInstalledAppsEnabled" -Value 0 -Type "DWord";
|
|
||||||
Set-ItemProperty "$contentDeliveryPath" -Name "SystemPaneSuggestionsEnabled" -Value 0 -Type "DWord";
|
|
||||||
|
|
||||||
Pop-Location;
|
Pop-Location;
|
||||||
Remove-Item -Recurse "$tempDir";
|
Remove-Item -Recurse "$tempDir";
|
||||||
|
|
Loading…
Reference in a new issue