Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.69k stars 1.08k forks source link

Add EnablePhonePcLinking tweak #278

Closed ghost closed 4 years ago

ghost commented 4 years ago

Can be useful to add functions for to handle Phone-PC linking. These can be the functions:

function EnablePhonePcLinking {
    Write-Output "Enabling Phone PC linking..."

    # 1) Enable MMX
    $regKeyPath = "HKLM:\Software\Policies\Microsoft\Windows\System"
    if (!(Test-Path -Path $regKeyPath)) { New-Item -Path $regKeyPath -Force | Out-Null }
    Set-ItemProperty $regKeyPath -Name "EnableMmx" -Type DWord -Value 1

    # 2) Enable shared experience
    $regKeyPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\CDP"
    if (!(Test-Path -Path $regKeyPath)) { New-Item -Path $regKeyPath -Force | Out-Null }
    Set-ItemProperty -Path $regKeyPath -Name "RomeSdkChannelUserAuthzPolicy" -Type DWord -Value 1

    # 3) Enable Consumer features
    $regKeyPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
    if (! (Test-Path -Path $regKeyPath)) { New-Item -Path $regKeyPath -Force | Out-Null }
    Set-ItemProperty $regKeyPath -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 0
}

function DisablePhonePcLinking {
    Write-Output "Disabling Phone PC linking..."

    # 1) Disable MMX
    $regKeyPath = "HKLM:\Software\Policies\Microsoft\Windows\System"
    if (!(Test-Path -Path $regKeyPath)) { New-Item -Path $regKeyPath -Force | Out-Null }
    Set-ItemProperty $regKeyPath -Name "EnableMmx" -Type DWord -Value 0
}

Some doubts and open questions :

  1. This feature requires enabling Consumer Features: this feature is instead disabled by the function DisableAppSuggestions. This can be a side effect.
  2. This feature requires enabling Shared Experiences: this feature can be instead explicitly disabled by the function DisableSharedExperiences. Also this can be a side effect.
  3. The proposed DisablePhonePcLinking function, from the other hand, disable only the one feature that allows the Phone-PC linking: this means that Consumer Features and Shared Experiences keep enabled: also this can be a side effect.

These points cause an execution affected by the order of the calls: the user must be aware of this and must decide how to act.

What do you think about it? @Disassembler0

Disassembler0 commented 4 years ago

Well... to sum it up, your proposal basically is "If you'd like to use Phone-PC linking, don't disable the functionality for Phone-PC linking" :)

The EnableMmx isn't needed, as the feature is enabled by default. Moreover touching that key caused some nasty problems with start menu cache resets (#145).

Although DisableWindowsConsumerFeatures is indeed required for the phone linking to work, it may also have unwanted side effects as it enables application suggestions and other obtrusive functions. So my proposal is that I review what exactly does DisableWindowsConsumerFeatures do and what impact does it have to keep it enabled. If the other registry keys present in DisableAppSuggestions handle their job even without DisableWindowsConsumerFeatures, then the key can be removed from the tweak and DisableSharedExperiences gets a nice note stating that it shouldn't be used if one would like to link a phone (which at that point will be a bit tautological anyway as that's one of the main reasons why one would use Shared Experiences).

Disassembler0 commented 4 years ago

So the fix is more pragmatic than I thought. In recent Windows builds, DisableWindowsConsumerFeatures is applicable only to Education and Enterprise SKUs and seems to have no effect on Home and Pro. The other DisableAppSuggestions keys along with DisableBackgroundApps and UnpinStartMenuTiles seem to do good enough job hiding the crapware.

So I'll remove DisableWindowsConsumerFeatures and then the only thing you need to do on fresh installations in order to keep Phone-PC linking is simply not apply DisableSharedExperiences.