TaskbarDa (Widgets) registry change is now blocked

Discussion in 'Windows 11' started by Outbreaker, Aug 14, 2024.

  1. 12 lb Turkey

    12 lb Turkey MDL Member

    Nov 24, 2022
    121
    67
    10
    Reposted using a CMD wrapper. Fixed the "0" output.

    Code:
    <# : batch script
    @echo off
    powershell -nop ^
    "if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { ^
        Start-Process 'cmd' -ArgumentList '/c start /min %~dpnx0' -Verb RunAs ^
    } ^
    else { ^
        Invoke-Expression ([System.IO.File]::ReadAllText('%~f0')) ^
    }"
    goto :eof
    #>
    
    $MethodDefinition = @'
    [DllImport("Shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false)]
        public static extern int HashData(
            byte[] pbData,
            int cbData,
            byte[] piet,
            int outputLen);
    '@
    
    $Shlwapi = Add-Type -MemberDefinition $MethodDefinition -Name 'Shlwapi' -Namespace 'Win32' -PassThru
    
    $option = 2 # 2 is for off
    
    $machineIdReg = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\SQMClient\' -Name 'MachineId' -ErrorAction SilentlyContinue
    $machineId = '{C283D224-5CAD-4502-95F0-2569E4C85074}' # Fallback Value
    
    if( $machineIdReg) {
        $machineId = $machineIdReg.MachineId
    }
    
    $combined = $machineId + '_' + $option.ToString()
    $reverse = $combined[($combined.Length-1)..0] -join ''
    $bytesIn = [system.Text.Encoding]::Unicode.GetBytes($reverse)
    $bytesOut = [byte[]]::new(4)
    $Shlwapi::HashData($bytesIn,0x53, $bytesOut, $bytesOut.Count) | Out-Null
    
    $dwordData = [System.BitConverter]::ToUInt32($bytesOut,0)
    
    Copy-Item (Get-Command reg).Source '.\reg1.exe'
    
    Start-Process -NoNewWindow -Wait -FilePath '.\reg1.exe' -ArgumentList "add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds /v ShellFeedsTaskbarViewMode /t REG_DWORD /d $option /f 1>NUL"
    Start-Process -NoNewWindow -Wait -FilePath '.\reg1.exe' -ArgumentList "add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds /v EnShellFeedsTaskbarViewMode /t REG_DWORD /d $dwordData /f 1>NUL"
    
    Remove-Item '.\reg1.exe'
    
     
  2. RanCorX2

    RanCorX2 MDL Expert

    Jul 19, 2009
    1,021
    573
    60
    sorry to bring this up again, but 23h2 has this prob too. as i was having the issue adding some registry keys in hyper-v vm, but doing as users in this thread said making a copy of reg.exe and renaming to reg1.exe allowed me to import the keys.
    also the UCPD service exists on 23h2.