Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. ECHO OFF
  2. SETLOCAL EnableDelayedExpansion
  3.  
  4. FOR /f "tokens=*" %%G in ('dir /b /a:d-s-l "%SystemDrive%\Users"') DO (
  5.     IF /I NOT "%%G"=="Public" (
  6.  
  7.         reg.exe load HKU\XYZ "%SystemDrive%\Users\%%G\NTUser.dat"
  8.  
  9.         IF NOT ERRORLEVEL 1 (
  10.  
  11.             call :regchanges XYZ
  12.  
  13.             reg.exe unload HKU\XYZ
  14.         )
  15.     )
  16. )
  17.  
  18. FOR /f "tokens=1,2 skip=1" %%G IN ('wmic.exe PATH Win32_UserProfile get loaded^,sid') DO (
  19.     IF /I "%%G"=="True" (
  20.         set sid=%%H
  21.  
  22.         IF /I "!sid:~0,8!"=="S-1-5-21" (
  23.            
  24.             call :regchanges !sid!            
  25.         )
  26.     )
  27. )
  28.  
  29. exit /b
  30.  
  31. :regchanges
  32.  
  33. REM reg.exe add "HKU\%1\..." /v ... /t ... /d ... /f
  34.  
  35. reg.exe delete "HKU\%1\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v Win10UpgradeMessage /f
  36.  
  37. REM reg.exe add "HKU\%1\Software\Temp3" /v TempValue /t REG_SZ /d "A sub Test" /f