@echo off
echo.
echo HUNGNP18@FPT.COM
echo ------------------------------
net session >nul 2>&1

if %errorlevel% neq 0 (
    echo Can co quyen quan tri "Administrator".
    pause
)

::Tắt Hibernate and Fast Startup.
powercfg /hibernate off
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f

:: Tắt Sleep Mode (Prevent Sleep Timeout).
powercfg /change standby-timeout-ac 0
powercfg /change standby-timeout-dc 0

:: Bật Lock Screen Button (Remove Lock Option from Start Menu).
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v DisableLockWorkstation /t REG_DWORD /d 1 /f

:: Tắt Disable User Account Control (UAC), Vô hiệu hóa Windows SmartScreen
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v EnableSmartScreen /t REG_DWORD /d 0 /f

::Tắt Device Encryption (C, D)
manage-bde -off C:
manage-bde -off D:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v PreventDeviceEncryption /t REG_DWORD /d 1 /f

::Vô hiệu hóa Power Throttling
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling" /v PowerThrottlingOff /t REG_DWORD /d 1 /f

:: Bật Explorer This PC thay vi Quick Access.
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "LaunchTo" /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowRecentFolders" /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "Pinning" /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowRecentDocs" /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Office\16.0\Common\Internet" /v "ShowFilesFromOfficeCom" /t REG_DWORD /d 0 /f

:: Bật Recycle Bin tren Desktop.
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {645FF040-5081-101B-9F08-00AA002F954E} /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /v IconSize /t REG_DWORD /d 32 /f
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /V link /T REG_Binary /D 00000000 /F
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\NamingTemplates" /V ShortcutNameTemplate /F
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v HideRecommendedSection /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}" /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f

:: Bật che do Dark Mode cho Windows.
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\DWM" /v "Color" /t REG_DWORD /d 0x0078D7 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AccentColor" /t REG_DWORD /d 0x0078D7 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "ShowColorInTaskbarAndStart" /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v ColorPrevalence /t REG_DWORD /d 1 /f

::Disable Dynamic Lighting
reg add "HKLM\SOFTWARE\Microsoft\DynamicLighting" /v EnableDynamicLighting /t REG_DWORD /d 0 /f

::Thanh tim kiem, Taskview, News, widgets
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" /v SearchboxTaskbarMode /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowTaskViewButton /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests\AllowNewsAndInterests" /v value /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v DisableNotificationCenter /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v DisableNotificationCenter /t REG_DWORD /d 0 /f

::Xoa Recommened trên Menu Start.
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v HideRecommendedSection /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Education" /v IsEducationEnvironment /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v HideRecommendedSection /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Start_IrisRecommendations /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v HideRecommendedSection /t REG_DWORD /d 1 /f

::Disable Windows Web Search
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v "DisableSearchBoxSuggestions" /t REG_DWORD /d 1 /f

::Chuyen Taskbar Alignment sang trai.
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarAl /t REG_DWORD /d 0 /f

::Tắt thong bao Toast trong Windows 11.
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications" /v ToastEnabled /t REG_DWORD /d 0 /f
reg add "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoRebootWithLoggedOnUsers /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications" /v ToastEnabled /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings" /v WindowsDefenderSecurityCenter /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings" /v NOCLOSE /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings" /v FocusAssistState /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "RotatingLockScreenEnabled" /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "RotatingLockScreenOverlayEnabled" /t REG_DWORD /d 0 /f

::Dang go OneDrive khoi thanh ben File Explorer...
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{33E28130-4E1E-4676-835A-98395C3BC3BB}" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{18989B1D-99B5-455B-841C-AB7C74E4DDFC}" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{4BD8D571-6D19-48D3-BE97-422220080E43}" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}" /f
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v "LaunchTo" /t REG_DWORD /d "1"
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v ShowRecent /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v ShowFrequent /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v SettingsPageVisibility /t REG_SZ /d "hide:home" /f

:: Tắt Animation effects trong Accessibility
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Accessibility" /v AnimationFilterEnabled /t REG_DWORD /d 0 /f
reg add "HKCU\Control Panel\Desktop\WindowMetrics" /v MinAnimate /t REG_SZ /d 0 /f

::Cài đặt hình nền mặc định.
set "SOURCE=%~dp0\Customize\Wallpaper\img01.png"
copy "%SOURCE%" "%SystemRoot%\Web\Wallpaper\Windows\img01.png"
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers" /v BackgroundType /t REG_DWORD /d 0 /f
reg add "HKCU\Control Panel\Personalization\DesktopSlideshow" /v SlideshowEnabled /t REG_DWORD /d 0 /f
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\img01.png" /f
reg add "HKCU\Control Panel\Desktop" /v TileWallpaper /t REG_SZ /d "0" /f
reg add "HKCU\Control Panel\Desktop" /v WallpaperStyle /t REG_SZ /d "10" /f

copy /Y "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Word.lnk" "%USERPROFILE%\Desktop"
copy /Y "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Excel.lnk" "%USERPROFILE%\Desktop"
copy /Y "%ProgramData%\Microsoft\Windows\Start Menu\Programs\PowerPoint.lnk" "%USERPROFILE%\Desktop"

RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

:: Bật múi giờ tự động
reg add "HKLM\SYSTEM\CurrentControlSet\Services\tzautoupdate" /v Start /t REG_DWORD /d 2 /f

:: Chỉ bật Windows Update.
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AUOptions /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f

:: Tắt nhận cập nhật sản phẩm Microsoft từ Windows Update
reg add "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v AllowMUUpdateService /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /v HideInsiderPage /t REG_DWORD /d 1 /f

::Dọn RAM cache.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v ClearPageFileAtShutdown /t REG_DWORD /d 1 /f

:: Bật auto Entask.
reg add "HKCU\Control Panel\Desktop" /v AutoEndTasks /t REG_SZ /d 1 /f

::Tắt Sysmain.
sc config "SysMain" start= disabled
sc stop "SysMain"
reg add "HKLM\SYSTEM\CurrentControlSet\Services\SysMain" /v Start /t REG_DWORD /d 4 /f

:: Tắt dịch vụ "Connected User Experiences and Telemetry"...
sc stop "DiagTrack"
sc config "DiagTrack" start= disabled
reg add "HKLM\System\CurrentControlSet\Services\DiagTrack" /v Start /t REG_DWORD /d 4 /f

:: Tắt dịch vụ "Windows Insider Service"...
sc stop "wisvc"
sc config "wisvc" start= disabled
reg add "HKLM\System\CurrentControlSet\Services\wisvc " /v Start /t REG_DWORD /d 4 /f

:: Tắt dịch vụ "Windows Error Reporting Service"
sc stop "WerSvc"
sc config "WerSvc" start= disabled
reg add "HKLM\System\CurrentControlSet\Services\WerSvc" /v Start /t REG_DWORD /d 4 /f

:: Tắt Windows Defender
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableBehaviorMonitoring /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableOnAccessProtection /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableScanOnRealtimeEnable /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows Defender\Features" /v TamperProtection /t REG_DWORD /d 0 /f

:: 3. Ghi registry thông tin OEM
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v Manufacturer /t REG_SZ /d "FPTSHOP 289 NGUYEN VAN CU" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v Model /t REG_SZ /d "FPTSHOP 289 NGUYEN VAN CU" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v SupportHours /t REG_SZ /d "07:30 - 21:30" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v SupportPhone /t REG_SZ /d "0899.688.633" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v SupportURL /t REG_SZ /d "https://m.me/CTO289NVC" /f

:: Khôi phục Windows Photo Viewer cho các định dạng ảnh
reg add "HKCU\SOFTWARE\Classes\.bmp" /ve /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
reg add "HKCU\SOFTWARE\Classes\.gif" /ve /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
reg add "HKCU\SOFTWARE\Classes\.jpe" /ve /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
reg add "HKCU\SOFTWARE\Classes\.jpeg" /ve /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
reg add "HKCU\SOFTWARE\Classes\.jpg" /ve /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
reg add "HKCU\SOFTWARE\Classes\.png" /ve /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
reg add "HKCU\SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /ve /t REG_SZ /d "Windows Photo Viewer" /f
reg add "HKCU\SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command" /ve /t REG_SZ /d "%SystemRoot%\\System32\\rundll32.exe %SystemRoot%\\System32\\shimgvw.dll,ImageView_Fullscreen %%1" /f

for %%i in (bmp gif jpe jpeg jpg png) do (
    reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.%%i\UserChoice" /v Progid /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f
)

for %%i in (bmp gif jpe jpeg jpg png) do (
    reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.%%i\OpenWithProgids" /v "PhotoViewer.FileAssoc.Tiff" /t REG_NONE /f
)

:: Thay đổi con trỏ chuột.
set "SRC=%~dp0\Customize\Cursors\Normal"
set "DST=%SystemRoot%\Web\Wallpaper\Windows\Cursors"

if not exist "%DST%" (
    mkdir "%DST%"
)

xcopy "%SRC%" "%DST%" /I /Y
reg add "HKCU\Control Panel\Cursors" /v AppStarting /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Working.ani" /f
reg add "HKCU\Control Panel\Cursors" /v Arrow /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Normal.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Crosshair /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Precision.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Hand /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Link.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Help /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Help.cur" /f
reg add "HKCU\Control Panel\Cursors" /v IBeam /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Text.cur" /f
reg add "HKCU\Control Panel\Cursors" /v No /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Unavailable.cur" /f
reg add "HKCU\Control Panel\Cursors" /v NWPen /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Handwriting.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Person /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Person.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Pin /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Pin.cur" /f
reg add "HKCU\Control Panel\Cursors" /v SizeAll /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Move.cur" /f
reg add "HKCU\Control Panel\Cursors" /v SizeNESW /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Diagonal Resize 2.cur" /f
reg add "HKCU\Control Panel\Cursors" /v SizeNS /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Vertical Resize.cur" /f
reg add "HKCU\Control Panel\Cursors" /v SizeNWSE /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Diagonal Resize 1.cur" /f
reg add "HKCU\Control Panel\Cursors" /v SizeWE /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Horizontal Resize.cur" /f
reg add "HKCU\Control Panel\Cursors" /v UpArrow /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Alternate.cur" /f
reg add "HKCU\Control Panel\Cursors" /v Wait /t REG_SZ /d "%SystemRoot%\Web\Wallpaper\Windows\Cursors\Busy.ani" /f

RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
taskkill /f /im explorer.exe
start explorer.exe
timeout /t 1
shutdown /r /t 0

pause
exit
