Closed scruel closed 6 years ago
Sorry, this doesn't make any sense.
1) 4 out of the 7 values don't exist after installation. You can't loop through something you don't have.
2) The values which don't originally exist aren't just set to 1 in EnableAppSuggestions
but removed altogether to restore the original state as completely as possible.
3) As per FAQ:
Q: Why are there repeated pieces of code throughout some functions? A: So you can directly take a function block or a line from within a function and use it elsewhere, without elaborating on any dependencies.
This applies also for the individual registry modification. Same reason why eg. bloatware removal tweaks don't use loops.
@Disassembler0 All right...But I think you haven't reviewed all parts of my code?
the following line of code I added in, may answer your 1, 2 questions above? If($_.Name -Match 'SubscribedContent') {
Also, I've tested it from 1703 to 1809 and works fine for myself.
(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -ErrorAction SilentlyContinue).PSObject.Properties | ForEach-Object {
If ($_.Name -Match 'SubscribedContent') {
Write-Output $_.Name
}
}
on clean installation of 1809 prints
SubscribedContent-338389Enabled
SubscribedContent-338388Enabled
SubscribedContent-353696Enabled
Therefore the 4 keys which don't exist won't get set.
I noticed that SubscribedContent items could be pre-guessed by looking at the ContentDeliveryManager\Subscriptions subkeys, so these keys might be looped as their numbers match those SubscribedContent items...mostly. Unfortunately there seem to be unused numbers and worse, I also noticed one extra SubscribedContent* that is not covered.
As per FAQ
I wouldn't always stick with this rule, especially for potentially dynamic situation. :) As you didn't for example in DisableBackgroundApps. ;)
...so these keys might be looped...
How would you do the revert tweak for this which would restore the exact defaults?
...As you didn't for example in DisableBackgroundApps
That's just an ugly workaround because the toggle to disable them all in one go is broken in Windows.
Replace all the code for 'SubscribedContent' like keys in registry with the loop code.