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
    120
    64
    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'