selfharm

sss

Jun 6th, 2023
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 79.90 KB | None | 0 0
  1. @echo off
  2. :: https://privacy.sexy — v0.11.4 — Wed, 07 Jun 2023 02:33:59 GMT
  3. :: Ensure admin privileges
  4. fltmc >nul 2>&1 || (
  5.     echo Administrator privileges are required.
  6.     PowerShell Start -Verb RunAs '%0' 2> nul || (
  7.         echo Right-click on the script and select "Run as administrator".
  8.         pause & exit 1
  9.     )
  10.     exit 0
  11. )
  12.  
  13.  
  14. :: ----------------------------------------------------------
  15. :: ----------------------Text messaging----------------------
  16. :: ----------------------------------------------------------
  17. echo --- Text messaging
  18. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceQuery = 'MessagingService'; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceQuery -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service query `"^""$serviceQuery`"^"" did not yield any results, no need to disable it."^""; Exit 0; }; $serviceName = $service.Name; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, trying to stop it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if service info is not found in registry #>; $registryKey = "^""HKLM:\SYSTEM\CurrentControlSet\Services\$serviceName"^""; if(!(Test-Path $registryKey)) {; Write-Host "^""`"^""$registryKey`"^"" is not found in registry, cannot enable it."^""; Exit 0; }; <# -- 4. Skip if already disabled #>; if( $(Get-ItemProperty -Path "^""$registryKey"^"").Start -eq 4) {; Write-Host "^""`"^""$serviceName`"^"" is already disabled from start, no further action is needed."^""; Exit 0; }; <# -- 5. Disable service #>; try {; Set-ItemProperty $registryKey -Name Start -Value 4 -Force -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  19. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceQuery = 'MessagingService_*'; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceQuery -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service query `"^""$serviceQuery`"^"" did not yield any results, no need to disable it."^""; Exit 0; }; $serviceName = $service.Name; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, trying to stop it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if service info is not found in registry #>; $registryKey = "^""HKLM:\SYSTEM\CurrentControlSet\Services\$serviceName"^""; if(!(Test-Path $registryKey)) {; Write-Host "^""`"^""$registryKey`"^"" is not found in registry, cannot enable it."^""; Exit 0; }; <# -- 4. Skip if already disabled #>; if( $(Get-ItemProperty -Path "^""$registryKey"^"").Start -eq 4) {; Write-Host "^""`"^""$serviceName`"^"" is already disabled from start, no further action is needed."^""; Exit 0; }; <# -- 5. Disable service #>; try {; Set-ItemProperty $registryKey -Name Start -Value 4 -Force -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  20. :: ----------------------------------------------------------
  21.  
  22.  
  23. :: ----------------------------------------------------------
  24. :: ------------------Contact data indexing-------------------
  25. :: ----------------------------------------------------------
  26. echo --- Contact data indexing
  27. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceQuery = 'PimIndexMaintenanceSvc'; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceQuery -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service query `"^""$serviceQuery`"^"" did not yield any results, no need to disable it."^""; Exit 0; }; $serviceName = $service.Name; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, trying to stop it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if service info is not found in registry #>; $registryKey = "^""HKLM:\SYSTEM\CurrentControlSet\Services\$serviceName"^""; if(!(Test-Path $registryKey)) {; Write-Host "^""`"^""$registryKey`"^"" is not found in registry, cannot enable it."^""; Exit 0; }; <# -- 4. Skip if already disabled #>; if( $(Get-ItemProperty -Path "^""$registryKey"^"").Start -eq 4) {; Write-Host "^""`"^""$serviceName`"^"" is already disabled from start, no further action is needed."^""; Exit 0; }; <# -- 5. Disable service #>; try {; Set-ItemProperty $registryKey -Name Start -Value 4 -Force -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  28. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceQuery = 'PimIndexMaintenanceSvc_*'; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceQuery -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service query `"^""$serviceQuery`"^"" did not yield any results, no need to disable it."^""; Exit 0; }; $serviceName = $service.Name; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, trying to stop it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if service info is not found in registry #>; $registryKey = "^""HKLM:\SYSTEM\CurrentControlSet\Services\$serviceName"^""; if(!(Test-Path $registryKey)) {; Write-Host "^""`"^""$registryKey`"^"" is not found in registry, cannot enable it."^""; Exit 0; }; <# -- 4. Skip if already disabled #>; if( $(Get-ItemProperty -Path "^""$registryKey"^"").Start -eq 4) {; Write-Host "^""`"^""$serviceName`"^"" is already disabled from start, no further action is needed."^""; Exit 0; }; <# -- 5. Disable service #>; try {; Set-ItemProperty $registryKey -Name Start -Value 4 -Force -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  29. :: ----------------------------------------------------------
  30.  
  31.  
  32. :: ----------------------------------------------------------
  33. :: ---------Program Compatibility Assistant Service----------
  34. :: ----------------------------------------------------------
  35. echo --- Program Compatibility Assistant Service
  36. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'PcaSvc'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  37. :: ----------------------------------------------------------
  38.  
  39.  
  40. :: ----------------------------------------------------------
  41. :: -------Delivery Optimization (P2P Windows Updates)--------
  42. :: ----------------------------------------------------------
  43. echo --- Delivery Optimization (P2P Windows Updates)
  44. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceQuery = 'DoSvc'; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceQuery -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service query `"^""$serviceQuery`"^"" did not yield any results, no need to disable it."^""; Exit 0; }; $serviceName = $service.Name; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, trying to stop it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if service info is not found in registry #>; $registryKey = "^""HKLM:\SYSTEM\CurrentControlSet\Services\$serviceName"^""; if(!(Test-Path $registryKey)) {; Write-Host "^""`"^""$registryKey`"^"" is not found in registry, cannot enable it."^""; Exit 0; }; <# -- 4. Skip if already disabled #>; if( $(Get-ItemProperty -Path "^""$registryKey"^"").Start -eq 4) {; Write-Host "^""`"^""$serviceName`"^"" is already disabled from start, no further action is needed."^""; Exit 0; }; <# -- 5. Disable service #>; try {; Set-ItemProperty $registryKey -Name Start -Value 4 -Force -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  45. :: ----------------------------------------------------------
  46.  
  47.  
  48. :: ----------------------------------------------------------
  49. :: ------------------Kill OneDrive process-------------------
  50. :: ----------------------------------------------------------
  51. echo --- Kill OneDrive process
  52. taskkill /f /im OneDrive.exe
  53. :: ----------------------------------------------------------
  54.  
  55.  
  56. :: ----------------------------------------------------------
  57. :: --------------------Uninstall OneDrive--------------------
  58. :: ----------------------------------------------------------
  59. echo --- Uninstall OneDrive
  60. if %PROCESSOR_ARCHITECTURE%==x86 (
  61.     %SystemRoot%\System32\OneDriveSetup.exe /uninstall 2>nul
  62. ) else (
  63.     %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall 2>nul
  64. )
  65. :: ----------------------------------------------------------
  66.  
  67.  
  68. :: ----------------------------------------------------------
  69. :: ----------------Remove OneDrive leftovers-----------------
  70. :: ----------------------------------------------------------
  71. echo --- Remove OneDrive leftovers
  72. rd "%UserProfile%\OneDrive" /q /s
  73. rd "%LocalAppData%\Microsoft\OneDrive" /q /s
  74. rd "%ProgramData%\Microsoft OneDrive" /q /s
  75. rd "%SystemDrive%\OneDriveTemp" /q /s
  76. :: ----------------------------------------------------------
  77.  
  78.  
  79. :: ----------------------------------------------------------
  80. :: ----------------Delete OneDrive shortcuts-----------------
  81. :: ----------------------------------------------------------
  82. echo --- Delete OneDrive shortcuts
  83. del "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Microsoft OneDrive.lnk" /s /f /q
  84. del "%APPDATA%\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" /s /f /q
  85. del "%USERPROFILE%\Links\OneDrive.lnk" /s /f /q
  86. :: ----------------------------------------------------------
  87.  
  88.  
  89. :: ----------------------------------------------------------
  90. :: ----------------Disable usage of OneDrive-----------------
  91. :: ----------------------------------------------------------
  92. echo --- Disable usage of OneDrive
  93. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\OneDrive" /t REG_DWORD /v "DisableFileSyncNGSC" /d 1 /f
  94. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\OneDrive" /t REG_DWORD /v "DisableFileSync" /d 1 /f
  95. :: ----------------------------------------------------------
  96.  
  97.  
  98. :: ----------------------------------------------------------
  99. :: ---Prevent automatic OneDrive install for current user----
  100. :: ----------------------------------------------------------
  101. echo --- Prevent automatic OneDrive install for current user
  102. reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f
  103. :: ----------------------------------------------------------
  104.  
  105.  
  106. :: ----------------------------------------------------------
  107. :: -----Prevent automatic OneDrive install for new users-----
  108. :: ----------------------------------------------------------
  109. echo --- Prevent automatic OneDrive install for new users
  110. reg load "HKU\Default" "%SystemDrive%\Users\Default\NTUSER.DAT"
  111. reg delete "HKU\Default\software\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f
  112. reg unload "HKU\Default"
  113. :: ----------------------------------------------------------
  114.  
  115.  
  116. :: ----------------------------------------------------------
  117. :: ------------Remove OneDrive from explorer menu------------
  118. :: ----------------------------------------------------------
  119. echo --- Remove OneDrive from explorer menu
  120. reg delete "HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
  121. reg delete "HKCR\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
  122. reg add "HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v System.IsPinnedToNameSpaceTree /d "0" /t REG_DWORD /f
  123. reg add "HKCR\Wow6432Node\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v System.IsPinnedToNameSpaceTree /d "0" /t REG_DWORD /f
  124. :: ----------------------------------------------------------
  125.  
  126.  
  127. :: ----------------------------------------------------------
  128. :: -----------Delete all OneDrive related Services-----------
  129. :: ----------------------------------------------------------
  130. echo --- Delete all OneDrive related Services
  131. for /f "tokens=1 delims=," %%x in ('schtasks /query /fo csv ^| find "OneDrive"') do schtasks /Delete /TN %%x /F
  132. :: ----------------------------------------------------------
  133.  
  134.  
  135. :: ----------------------------------------------------------
  136. :: ------------Delete OneDrive path from registry------------
  137. :: ----------------------------------------------------------
  138. echo --- Delete OneDrive path from registry
  139. reg delete "HKCU\Environment" /v "OneDrive" /f
  140. :: ----------------------------------------------------------
  141.  
  142.  
  143. :: ----------------------------------------------------------
  144. :: ----------------Internet Explorer feature-----------------
  145. :: ----------------------------------------------------------
  146. echo --- Internet Explorer feature
  147. dism /Online /Disable-Feature /FeatureName:"Internet-Explorer-Optional-x64" /NoRestart
  148. dism /Online /Disable-Feature /FeatureName:"Internet-Explorer-Optional-x84" /NoRestart
  149. dism /Online /Disable-Feature /FeatureName:"Internet-Explorer-Optional-amd64" /NoRestart
  150. :: ----------------------------------------------------------
  151.  
  152.  
  153. :: ----------------------------------------------------------
  154. :: ---------------Windows Fax and Scan feature---------------
  155. :: ----------------------------------------------------------
  156. echo --- Windows Fax and Scan feature
  157. dism /Online /Disable-Feature /FeatureName:"FaxServicesClientPackage" /NoRestart
  158. :: ----------------------------------------------------------
  159.  
  160.  
  161. :: ----------------------------------------------------------
  162. :: -------------Internet Explorer 11 capability--------------
  163. :: ----------------------------------------------------------
  164. echo --- Internet Explorer 11 capability
  165. PowerShell -ExecutionPolicy Unrestricted -Command "Get-WindowsCapability -Online -Name 'Browser.InternetExplorer*' | Remove-WindowsCapability -Online"
  166. :: ----------------------------------------------------------
  167.  
  168.  
  169. :: ----------------------------------------------------------
  170. :: ------------Remove Meet Now icon from taskbar-------------
  171. :: ----------------------------------------------------------
  172. echo --- Remove Meet Now icon from taskbar
  173. reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d 1 /f
  174. :: ----------------------------------------------------------
  175.  
  176.  
  177. :: ----------------------------------------------------------
  178. :: -------------------Candy Crush Saga app-------------------
  179. :: ----------------------------------------------------------
  180. echo --- Candy Crush Saga app
  181. PowerShell -ExecutionPolicy Unrestricted -Command "Get-AppxPackage 'king.com.CandyCrushSaga' | Remove-AppxPackage"
  182. PowerShell -ExecutionPolicy Unrestricted -Command "Get-AppxPackage 'king.com.CandyCrushSodaSaga' | Remove-AppxPackage"
  183. :: ----------------------------------------------------------
  184.  
  185.  
  186. :: ----------------------------------------------------------
  187. :: ---Bio enrollment app (breaks biometric authentication)---
  188. :: ----------------------------------------------------------
  189. echo --- Bio enrollment app (breaks biometric authentication)
  190. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.BioEnrollment'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  191. :: ----------------------------------------------------------
  192.  
  193.  
  194. :: ----------------------------------------------------------
  195. :: -------------------Cred Dialog Host app-------------------
  196. :: ----------------------------------------------------------
  197. echo --- Cred Dialog Host app
  198. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.CredDialogHost'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  199. :: ----------------------------------------------------------
  200.  
  201.  
  202. :: ----------------------------------------------------------
  203. :: --------------------------EC app--------------------------
  204. :: ----------------------------------------------------------
  205. echo --- EC app
  206. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.ECApp'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  207. :: ----------------------------------------------------------
  208.  
  209.  
  210. :: ----------------------------------------------------------
  211. :: ---------------Lock app (shows lock screen)---------------
  212. :: ----------------------------------------------------------
  213. echo --- Lock app (shows lock screen)
  214. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.LockApp'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  215. :: ----------------------------------------------------------
  216.  
  217.  
  218. :: ----------------------------------------------------------
  219. :: ------------Search app (breaks Windows search)------------
  220. :: ----------------------------------------------------------
  221. echo --- Search app (breaks Windows search)
  222. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.Windows.Cortana'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  223. PowerShell -ExecutionPolicy Unrestricted -Command "Get-AppxPackage 'Microsoft.Windows.Search' | Remove-AppxPackage"
  224. :: ----------------------------------------------------------
  225.  
  226.  
  227. :: ----------------------------------------------------------
  228. :: ----------------Holographic First Run app-----------------
  229. :: ----------------------------------------------------------
  230. echo --- Holographic First Run app
  231. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.Windows.Holographic.FirstRun'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  232. :: ----------------------------------------------------------
  233.  
  234.  
  235. :: ----------------------------------------------------------
  236. :: --------------OOBE Network Captive Port app---------------
  237. :: ----------------------------------------------------------
  238. echo --- OOBE Network Captive Port app
  239. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.Windows.OOBENetworkCaptivePortal'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  240. :: ----------------------------------------------------------
  241.  
  242.  
  243. :: ----------------------------------------------------------
  244. :: -------------OOBE Network Connection Flow app-------------
  245. :: ----------------------------------------------------------
  246. echo --- OOBE Network Connection Flow app
  247. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.Windows.OOBENetworkConnectionFlow'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  248. :: ----------------------------------------------------------
  249.  
  250.  
  251. :: ----------------------------------------------------------
  252. :: -----Windows 10 Family Safety / Parental Controls app-----
  253. :: ----------------------------------------------------------
  254. echo --- Windows 10 Family Safety / Parental Controls app
  255. PowerShell -ExecutionPolicy Unrestricted -Command "$package = Get-AppxPackage -AllUsers 'Microsoft.Windows.ParentalControls'; if (!$package) {; Write-Host 'Not installed'; exit 0; }; $directories = @($package.InstallLocation, "^""$env:LOCALAPPDATA\Packages\$($package.PackageFamilyName)"^""); foreach($dir in $directories) {; if ( !$dir -Or !(Test-Path "^""$dir"^"") ) { continue }; cmd /c ('takeown /f "^""' + $dir + '"^"" /r /d y 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; cmd /c ('icacls "^""' + $dir + '"^"" /grant administrators:F /t 1> nul'); if($LASTEXITCODE) { throw 'Failed to take ownership' }; $files = Get-ChildItem -File -Path $dir -Recurse -Force; foreach($file in $files) {; if($file.Name.EndsWith('.OLD')) { continue }; $newName =  $file.FullName + '.OLD'; Write-Host "^""Rename '$($file.FullName)' to '$newName'"^""; Move-Item -LiteralPath "^""$($file.FullName)"^"" -Destination "^""$newName"^"" -Force; }; }"
  256. :: ----------------------------------------------------------
  257.  
  258.  
  259. :: ----------------------------------------------------------
  260. :: ----------------Disable automatic updates-----------------
  261. :: ----------------------------------------------------------
  262. echo --- Disable automatic updates
  263. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t "REG_DWORD" /d "0" /f
  264. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t "REG_DWORD" /d "2" /f
  265. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "ScheduledInstallDay" /t "REG_DWORD" /d "0" /f
  266. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "ScheduledInstallTime" /t "REG_DWORD" /d "3" /f
  267. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'UsoSvc'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  268. :: ----------------------------------------------------------
  269.  
  270.  
  271. :: ----------------------------------------------------------
  272. :: -------------Disable Microsoft Office logging-------------
  273. :: ----------------------------------------------------------
  274. echo --- Disable Microsoft Office logging
  275. reg add "HKCU\SOFTWARE\Microsoft\Office\15.0\Outlook\Options\Mail" /v "EnableLogging" /t REG_DWORD /d 0 /f
  276. reg add "HKCU\SOFTWARE\Microsoft\Office\16.0\Outlook\Options\Mail" /v "EnableLogging" /t REG_DWORD /d 0 /f
  277. reg add "HKCU\SOFTWARE\Microsoft\Office\15.0\Outlook\Options\Calendar" /v "EnableCalendarLogging" /t REG_DWORD /d 0 /f
  278. reg add "HKCU\SOFTWARE\Microsoft\Office\16.0\Outlook\Options\Calendar" /v "EnableCalendarLogging" /t REG_DWORD /d 0 /f
  279. reg add "HKCU\SOFTWARE\Microsoft\Office\15.0\Word\Options" /v "EnableLogging" /t REG_DWORD /d 0 /f
  280. reg add "HKCU\SOFTWARE\Microsoft\Office\16.0\Word\Options" /v "EnableLogging" /t REG_DWORD /d 0 /f
  281. reg add "HKCU\SOFTWARE\Policies\Microsoft\Office\15.0\OSM" /v "EnableLogging" /t REG_DWORD /d 0 /f
  282. reg add "HKCU\SOFTWARE\Policies\Microsoft\Office\16.0\OSM" /v "EnableLogging" /t REG_DWORD /d 0 /f
  283. reg add "HKCU\SOFTWARE\Policies\Microsoft\Office\15.0\OSM" /v "EnableUpload" /t REG_DWORD /d 0 /f
  284. reg add "HKCU\SOFTWARE\Policies\Microsoft\Office\16.0\OSM" /v "EnableUpload" /t REG_DWORD /d 0 /f
  285. :: ----------------------------------------------------------
  286.  
  287.  
  288. :: ----------------------------------------------------------
  289. :: -----------------Disable client telemetry-----------------
  290. :: ----------------------------------------------------------
  291. echo --- Disable client telemetry
  292. reg add "HKCU\SOFTWARE\Microsoft\Office\Common\ClientTelemetry" /v "DisableTelemetry" /t REG_DWORD /d 1 /f
  293. reg add "HKCU\SOFTWARE\Microsoft\Office\16.0\Common\ClientTelemetry" /v "DisableTelemetry" /t REG_DWORD /d 1 /f
  294. reg add "HKCU\SOFTWARE\Microsoft\Office\Common\ClientTelemetry" /v "VerboseLogging" /t REG_DWORD /d 0 /f
  295. reg add "HKCU\SOFTWARE\Microsoft\Office\16.0\Common\ClientTelemetry" /v "VerboseLogging" /t REG_DWORD /d 0 /f
  296. :: ----------------------------------------------------------
  297.  
  298.  
  299. :: ----------------------------------------------------------
  300. :: ---------Customer Experience Improvement Program----------
  301. :: ----------------------------------------------------------
  302. echo --- Customer Experience Improvement Program
  303. reg add "HKCU\SOFTWARE\Microsoft\Office\15.0\Common" /v "QMEnable" /t REG_DWORD /d 0 /f
  304. reg add "HKCU\SOFTWARE\Microsoft\Office\16.0\Common" /v "QMEnable" /t REG_DWORD /d 0 /f
  305. :: ----------------------------------------------------------
  306.  
  307.  
  308. :: ----------------------------------------------------------
  309. :: ---------------------Disable feedback---------------------
  310. :: ----------------------------------------------------------
  311. echo --- Disable feedback
  312. reg add "HKCU\SOFTWARE\Microsoft\Office\15.0\Common\Feedback" /v "Enabled" /t REG_DWORD /d 0 /f
  313. reg add "HKCU\SOFTWARE\Microsoft\Office\16.0\Common\Feedback" /v "Enabled" /t REG_DWORD /d 0 /f
  314. :: ----------------------------------------------------------
  315.  
  316.  
  317. :: ----------------------------------------------------------
  318. :: -----------------Disable telemetry agent------------------
  319. :: ----------------------------------------------------------
  320. echo --- Disable telemetry agent
  321. schtasks /change /TN "Microsoft\Office\OfficeTelemetryAgentFallBack" /DISABLE
  322. schtasks /change /TN "Microsoft\Office\OfficeTelemetryAgentFallBack2016" /DISABLE
  323. schtasks /change /TN "Microsoft\Office\OfficeTelemetryAgentLogOn" /DISABLE
  324. schtasks /change /TN "Microsoft\Office\OfficeTelemetryAgentLogOn2016" /DISABLE
  325. :: ----------------------------------------------------------
  326.  
  327.  
  328. :: ----------------------------------------------------------
  329. :: --------------Disable Subscription Heartbeat--------------
  330. :: ----------------------------------------------------------
  331. echo --- Disable Subscription Heartbeat
  332. schtasks /change /TN "Microsoft\Office\Office 15 Subscription Heartbeat" /DISABLE
  333. schtasks /change /TN "Microsoft\Office\Office 16 Subscription Heartbeat" /DISABLE
  334. :: ----------------------------------------------------------
  335.  
  336.  
  337. :: ----------------------------------------------------------
  338. :: -------------Uninstall NVIDIA telemetry tasks-------------
  339. :: ----------------------------------------------------------
  340. echo --- Uninstall NVIDIA telemetry tasks
  341. if exist "%ProgramFiles%\NVIDIA Corporation\Installer2\InstallerCore\NVI2.DLL" (
  342.     rundll32 "%PROGRAMFILES%\NVIDIA Corporation\Installer2\InstallerCore\NVI2.DLL",UninstallPackage NvTelemetryContainer
  343.     rundll32 "%PROGRAMFILES%\NVIDIA Corporation\Installer2\InstallerCore\NVI2.DLL",UninstallPackage NvTelemetry
  344. )
  345. :: ----------------------------------------------------------
  346.  
  347.  
  348. :: ----------------------------------------------------------
  349. :: ----------Delete NVIDIA residual telemetry files----------
  350. :: ----------------------------------------------------------
  351. echo --- Delete NVIDIA residual telemetry files
  352. del /s %SystemRoot%\System32\DriverStore\FileRepository\NvTelemetry*.dll
  353. rmdir /s /q "%ProgramFiles(x86)%\NVIDIA Corporation\NvTelemetry" 2>nul
  354. rmdir /s /q "%ProgramFiles%\NVIDIA Corporation\NvTelemetry" 2>nul
  355. :: ----------------------------------------------------------
  356.  
  357.  
  358. :: ----------------------------------------------------------
  359. :: --------------Opt out from NVIDIA telemetry---------------
  360. :: ----------------------------------------------------------
  361. echo --- Opt out from NVIDIA telemetry
  362. reg add "HKLM\SOFTWARE\NVIDIA Corporation\NvControlPanel2\Client" /v "OptInOrOutPreference" /t REG_DWORD /d 0 /f
  363. reg add "HKLM\SOFTWARE\NVIDIA Corporation\Global\FTS" /v "EnableRID44231" /t REG_DWORD /d 0 /f
  364. reg add "HKLM\SOFTWARE\NVIDIA Corporation\Global\FTS" /v "EnableRID64640" /t REG_DWORD /d 0 /f
  365. reg add "HKLM\SOFTWARE\NVIDIA Corporation\Global\FTS" /v "EnableRID66610" /t REG_DWORD /d 0 /f
  366. reg add "HKLM\SYSTEM\CurrentControlSet\Services\nvlddmkm\Global\Startup" /v "SendTelemetryData" /t REG_DWORD /d 0 /f
  367. :: ----------------------------------------------------------
  368.  
  369.  
  370. :: ----------------------------------------------------------
  371. :: --------Disable Nvidia Telemetry Container service--------
  372. :: ----------------------------------------------------------
  373. echo --- Disable Nvidia Telemetry Container service
  374. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'NvTelemetryContainer'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  375. :: ----------------------------------------------------------
  376.  
  377.  
  378. :: ----------------------------------------------------------
  379. :: ------------Disable NVIDIA telemetry services-------------
  380. :: ----------------------------------------------------------
  381. echo --- Disable NVIDIA telemetry services
  382. schtasks /change /TN NvTmMon_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8} /DISABLE
  383. schtasks /change /TN NvTmRep_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8} /DISABLE
  384. schtasks /change /TN NvTmRepOnLogon_{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8} /DISABLE
  385. :: ----------------------------------------------------------
  386.  
  387.  
  388. :: ----------------------------------------------------------
  389. :: ------------------------Shazam app------------------------
  390. :: ----------------------------------------------------------
  391. echo --- Shazam app
  392. PowerShell -ExecutionPolicy Unrestricted -Command "Get-AppxPackage 'ShazamEntertainmentLtd.Shazam' | Remove-AppxPackage"
  393. :: ----------------------------------------------------------
  394.  
  395.  
  396. :: ----------------------------------------------------------
  397. :: ----Disable Customer Experience Improvement (CEIP/SQM)----
  398. :: ----------------------------------------------------------
  399. echo --- Disable Customer Experience Improvement (CEIP/SQM)
  400. reg add "HKLM\Software\Policies\Microsoft\SQMClient\Windows" /v "CEIPEnable" /t REG_DWORD /d "0" /f
  401. :: ----------------------------------------------------------
  402.  
  403.  
  404. :: ----------------------------------------------------------
  405. :: --------Disable Application Impact Telemetry (AIT)--------
  406. :: ----------------------------------------------------------
  407. echo --- Disable Application Impact Telemetry (AIT)
  408. reg add "HKLM\Software\Policies\Microsoft\Windows\AppCompat" /v "AITEnable" /t REG_DWORD /d "0" /f
  409. :: ----------------------------------------------------------
  410.  
  411.  
  412. :: ----------------------------------------------------------
  413. :: -----Disable Customer Experience Improvement Program------
  414. :: ----------------------------------------------------------
  415. echo --- Disable Customer Experience Improvement Program
  416. schtasks /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator" /DISABLE
  417. schtasks /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask" /DISABLE
  418. schtasks /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" /DISABLE
  419. :: ----------------------------------------------------------
  420.  
  421.  
  422. :: ----------------------------------------------------------
  423. :: -------Disable telemetry in data collection policy--------
  424. :: ----------------------------------------------------------
  425. echo --- Disable telemetry in data collection policy
  426. reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /d 0 /t REG_DWORD /f
  427. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 0 /f
  428. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 0 /f
  429. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "LimitEnhancedDiagnosticDataWindowsAnalytics" /t REG_DWORD /d 0 /f
  430. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 0 /f
  431. :: ----------------------------------------------------------
  432.  
  433.  
  434. :: ----------------------------------------------------------
  435. :: ----------------Disable license telemetry-----------------
  436. :: ----------------------------------------------------------
  437. echo --- Disable license telemetry
  438. reg add "HKLM\Software\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v "NoGenTicket" /t "REG_DWORD" /d "1" /f
  439. :: ----------------------------------------------------------
  440.  
  441.  
  442. :: ----------------------------------------------------------
  443. :: -----------------Disable error reporting------------------
  444. :: ----------------------------------------------------------
  445. echo --- Disable error reporting
  446. :: Disable Windows Error Reporting (WER)
  447. reg add "HKLM\Software\Policies\Microsoft\Windows\Windows Error Reporting" /v "Disabled" /t REG_DWORD /d "1" /f
  448. reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v "Disabled" /t "REG_DWORD" /d "1" /f
  449. :: DefaultConsent / 1 - Always ask (default) / 2 - Parameters only / 3 - Parameters and safe data / 4 - All data
  450. reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\Consent" /v "DefaultConsent" /t REG_DWORD /d "0" /f
  451. reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\Consent" /v "DefaultOverrideBehavior" /t REG_DWORD /d "1" /f
  452. :: Disable WER sending second-level data
  453. reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting" /v "DontSendAdditionalData" /t REG_DWORD /d "1" /f
  454. :: Disable WER crash dialogs, popups
  455. reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting" /v "LoggingDisabled" /t REG_DWORD /d "1" /f
  456. schtasks /Change /TN "Microsoft\Windows\ErrorDetails\EnableErrorDetailsUpdate" /Disable
  457. schtasks /Change /TN "Microsoft\Windows\Windows Error Reporting\QueueReporting" /Disable
  458. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'wersvc'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  459. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'wercplsupport'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  460. :: ----------------------------------------------------------
  461.  
  462.  
  463. :: ----------------------------------------------------------
  464. :: -Disable connected user experiences and telemetry service-
  465. :: ----------------------------------------------------------
  466. echo --- Disable connected user experiences and telemetry service
  467. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'DiagTrack'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  468. :: ----------------------------------------------------------
  469.  
  470.  
  471. :: ----------------------------------------------------------
  472. :: ---------Disable WAP push message routing service---------
  473. :: ----------------------------------------------------------
  474. echo --- Disable WAP push message routing service
  475. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'dmwappushservice'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  476. :: ----------------------------------------------------------
  477.  
  478.  
  479. :: ----------------------------------------------------------
  480. :: ----Disable diagnostics hub standard collector service----
  481. :: ----------------------------------------------------------
  482. echo --- Disable diagnostics hub standard collector service
  483. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'diagnosticshub.standardcollector.service'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  484. :: ----------------------------------------------------------
  485.  
  486.  
  487. :: ----------------------------------------------------------
  488. :: -----------Disable diagnostic execution service-----------
  489. :: ----------------------------------------------------------
  490. echo --- Disable diagnostic execution service
  491. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'diagsvc'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  492. :: ----------------------------------------------------------
  493.  
  494.  
  495. :: ----------------------------------------------------------
  496. :: --------Disable devicecensus.exe (telemetry) task---------
  497. :: ----------------------------------------------------------
  498. echo --- Disable devicecensus.exe (telemetry) task
  499. schtasks /change /TN "Microsoft\Windows\Device Information\Device" /disable
  500. :: ----------------------------------------------------------
  501.  
  502.  
  503. :: ----------------------------------------------------------
  504. :: -------Disable devicecensus.exe (telemetry) process-------
  505. :: ----------------------------------------------------------
  506. echo --- Disable devicecensus.exe (telemetry) process
  507. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\'DeviceCensus.exe'" /v "Debugger" /t REG_SZ /d "%windir%\System32\taskkill.exe" /f
  508. :: ----------------------------------------------------------
  509.  
  510.  
  511. :: Disable sending information to Customer Experience Improvement Program
  512. echo --- Disable sending information to Customer Experience Improvement Program
  513. schtasks /change /TN "Microsoft\Windows\Application Experience\ProgramDataUpdater" /disable
  514. :: ----------------------------------------------------------
  515.  
  516.  
  517. :: ----------------------------------------------------------
  518. :: -----Disable Application Impact Telemetry Agent task------
  519. :: ----------------------------------------------------------
  520. echo --- Disable Application Impact Telemetry Agent task
  521. schtasks /change /TN "Microsoft\Windows\Application Experience\AitAgent" /disable
  522. :: ----------------------------------------------------------
  523.  
  524.  
  525. :: ----------------------------------------------------------
  526. :: --Disable "Disable apps to improve performance" reminder--
  527. :: ----------------------------------------------------------
  528. echo --- Disable "Disable apps to improve performance" reminder
  529. schtasks /change /TN "Microsoft\Windows\Application Experience\StartupAppTask" /disable
  530. :: ----------------------------------------------------------
  531.  
  532.  
  533. :: ----------------------------------------------------------
  534. :: ------Disable Microsoft Compatibility Appraiser task------
  535. :: ----------------------------------------------------------
  536. echo --- Disable Microsoft Compatibility Appraiser task
  537. schtasks /change /TN "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /disable
  538. :: ----------------------------------------------------------
  539.  
  540.  
  541. :: Disable CompatTelRunner.exe (Microsoft Compatibility Appraiser) process
  542. echo --- Disable CompatTelRunner.exe (Microsoft Compatibility Appraiser) process
  543. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\'CompatTelRunner.exe'" /v "Debugger" /t REG_SZ /d "%windir%\System32\taskkill.exe" /f
  544. :: ----------------------------------------------------------
  545.  
  546.  
  547. :: ----------------------------------------------------------
  548. :: ------------Turn off Windows Location Provider------------
  549. :: ----------------------------------------------------------
  550. echo --- Turn off Windows Location Provider
  551. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v "DisableWindowsLocationProvider" /t REG_DWORD /d "1" /f
  552. :: ----------------------------------------------------------
  553.  
  554.  
  555. :: ----------------------------------------------------------
  556. :: ---------------Turn off location scripting----------------
  557. :: ----------------------------------------------------------
  558. echo --- Turn off location scripting
  559. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v "DisableLocationScripting" /t REG_DWORD /d "1" /f
  560. :: ----------------------------------------------------------
  561.  
  562.  
  563. :: ----------------------------------------------------------
  564. :: --------------------Turn off location---------------------
  565. :: ----------------------------------------------------------
  566. echo --- Turn off location
  567. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /v "DisableLocation" /d "1" /t REG_DWORD /f
  568. :: For older Windows (before 1903)
  569. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" /v "SensorPermissionState" /d "0" /t REG_DWORD /f
  570. reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" /v "Value" /t REG_SZ /d "Deny" /f
  571. :: ----------------------------------------------------------
  572.  
  573.  
  574. :: ----------------------------------------------------------
  575. :: -----------Do not allow search to use location------------
  576. :: ----------------------------------------------------------
  577. echo --- Do not allow search to use location
  578. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowSearchToUseLocation" /t REG_DWORD /d 0 /f
  579. :: ----------------------------------------------------------
  580.  
  581.  
  582. :: ----------------------------------------------------------
  583. :: -------------Disable web search in search bar-------------
  584. :: ----------------------------------------------------------
  585. echo --- Disable web search in search bar
  586. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /t REG_DWORD /d 1 /f
  587. :: ----------------------------------------------------------
  588.  
  589.  
  590. :: ----------------------------------------------------------
  591. :: --Do not search the web or display web results in Search--
  592. :: ----------------------------------------------------------
  593. echo --- Do not search the web or display web results in Search
  594. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d 0 /f
  595. :: ----------------------------------------------------------
  596.  
  597.  
  598. :: ----------------------------------------------------------
  599. :: -------------------Disable Bing search--------------------
  600. :: ----------------------------------------------------------
  601. echo --- Disable Bing search
  602. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "BingSearchEnabled" /t REG_DWORD /d 0 /f
  603. :: ----------------------------------------------------------
  604.  
  605.  
  606. :: ----------------------------------------------------------
  607. :: -------------------Do not allow Cortana-------------------
  608. :: ----------------------------------------------------------
  609. echo --- Do not allow Cortana
  610. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d 0 /f
  611. :: ----------------------------------------------------------
  612.  
  613.  
  614. :: ----------------------------------------------------------
  615. :: -------------Do not allow Cortana experience--------------
  616. :: ----------------------------------------------------------
  617. echo --- Do not allow Cortana experience
  618. reg add "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Experience\AllowCortana" /v "value" /t REG_DWORD /d 0 /f
  619. :: ----------------------------------------------------------
  620.  
  621.  
  622. :: Do not allow search and Cortana to search cloud sources like OneDrive and SharePoint
  623. echo --- Do not allow search and Cortana to search cloud sources like OneDrive and SharePoint
  624. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCloudSearch" /t REG_DWORD /d 0 /f
  625. :: ----------------------------------------------------------
  626.  
  627.  
  628. :: Disable Cortana speech interaction while the system is locked
  629. echo --- Disable Cortana speech interaction while the system is locked
  630. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d 0 /f
  631. :: ----------------------------------------------------------
  632.  
  633.  
  634. :: ----------------------------------------------------------
  635. :: ---------------Opt out from Cortana consent---------------
  636. :: ----------------------------------------------------------
  637. echo --- Opt out from Cortana consent
  638. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" /v "CortanaConsent" /t REG_DWORD /d 0 /f
  639. :: ----------------------------------------------------------
  640.  
  641.  
  642. :: ----------------------------------------------------------
  643. :: ------------Do not allow Cortana to be enabled------------
  644. :: ----------------------------------------------------------
  645. echo --- Do not allow Cortana to be enabled
  646. reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "CanCortanaBeEnabled" /t REG_DWORD /d 0 /f
  647. :: ----------------------------------------------------------
  648.  
  649.  
  650. :: ----------------------------------------------------------
  651. :: -Disable Cortana (Internet search results in start menu)--
  652. :: ----------------------------------------------------------
  653. echo --- Disable Cortana (Internet search results in start menu)
  654. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "CortanaEnabled" /t REG_DWORD /d 0 /f
  655. reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "CortanaEnabled" /t REG_DWORD /d 0 /f
  656. :: ----------------------------------------------------------
  657.  
  658.  
  659. :: ----------------------------------------------------------
  660. :: -------------Remove the Cortana taskbar icon--------------
  661. :: ----------------------------------------------------------
  662. echo --- Remove the Cortana taskbar icon
  663. reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v "ShowCortanaButton" /t REG_DWORD /d 0 /f
  664. :: ----------------------------------------------------------
  665.  
  666.  
  667. :: ----------------------------------------------------------
  668. :: -------------Disable Cortana in ambient mode--------------
  669. :: ----------------------------------------------------------
  670. echo --- Disable Cortana in ambient mode
  671. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "CortanaInAmbientMode" /t REG_DWORD /d 0 /f
  672. :: ----------------------------------------------------------
  673.  
  674.  
  675. :: ----------------------------------------------------------
  676. :: ---------Prevent Cortana from displaying history----------
  677. :: ----------------------------------------------------------
  678. echo --- Prevent Cortana from displaying history
  679. reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d 0 /f
  680. :: ----------------------------------------------------------
  681.  
  682.  
  683. :: ----------------------------------------------------------
  684. :: --------Prevent Cortana from using device history---------
  685. :: ----------------------------------------------------------
  686. echo --- Prevent Cortana from using device history
  687. reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d 0 /f
  688. :: ----------------------------------------------------------
  689.  
  690.  
  691. :: ----------------------------------------------------------
  692. :: ----------Disable "Hey Cortana" voice activation----------
  693. :: ----------------------------------------------------------
  694. echo --- Disable "Hey Cortana" voice activation
  695. reg add "HKCU\Software\Microsoft\Speech_OneCore\Preferences" /v "VoiceActivationOn" /t REG_DWORD /d 0 /f
  696. reg add "HKLM\Software\Microsoft\Speech_OneCore\Preferences" /v "VoiceActivationDefaultOn" /t REG_DWORD /d 0 /f
  697. :: ----------------------------------------------------------
  698.  
  699.  
  700. :: ----------------------------------------------------------
  701. :: -Disable Cortana listening to commands on Windows key + C-
  702. :: ----------------------------------------------------------
  703. echo --- Disable Cortana listening to commands on Windows key + C
  704. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" /v "VoiceShortcut" /t REG_DWORD /d 0 /f
  705. :: ----------------------------------------------------------
  706.  
  707.  
  708. :: ----------------------------------------------------------
  709. :: -----Disable using Cortana even when device is locked-----
  710. :: ----------------------------------------------------------
  711. echo --- Disable using Cortana even when device is locked
  712. reg add "HKCU\Software\Microsoft\Speech_OneCore\Preferences" /v "VoiceActivationEnableAboveLockscreen" /t REG_DWORD /d 0 /f
  713. :: ----------------------------------------------------------
  714.  
  715.  
  716. :: ----------------------------------------------------------
  717. :: ---------Disable automatic update of Speech Data----------
  718. :: ----------------------------------------------------------
  719. echo --- Disable automatic update of Speech Data
  720. reg add "HKCU\Software\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d 0 /f
  721. :: ----------------------------------------------------------
  722.  
  723.  
  724. :: ----------------------------------------------------------
  725. :: ----Disable Cortana voice support during Windows setup----
  726. :: ----------------------------------------------------------
  727. echo --- Disable Cortana voice support during Windows setup
  728. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v "DisableVoice" /t REG_DWORD /d 1 /f
  729. :: ----------------------------------------------------------
  730.  
  731.  
  732. :: ----------------------------------------------------------
  733. :: -----Disable search indexing encrypted items / stores-----
  734. :: ----------------------------------------------------------
  735. echo --- Disable search indexing encrypted items / stores
  736. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowIndexingEncryptedStoresOrItems" /t REG_DWORD /d 0 /f
  737. :: ----------------------------------------------------------
  738.  
  739.  
  740. :: ----------------------------------------------------------
  741. :: --Do not use automatic language detection when indexing---
  742. :: ----------------------------------------------------------
  743. echo --- Do not use automatic language detection when indexing
  744. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AlwaysUseAutoLangDetection" /t REG_DWORD /d 0 /f
  745. :: ----------------------------------------------------------
  746.  
  747.  
  748. :: ----------------------------------------------------------
  749. :: -------Disable ad customization with Advertising ID-------
  750. :: ----------------------------------------------------------
  751. echo --- Disable ad customization with Advertising ID
  752. reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d "0" /f
  753. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" /v "DisabledByGroupPolicy" /t REG_DWORD /d "1" /f
  754. :: ----------------------------------------------------------
  755.  
  756.  
  757. :: ----------------------------------------------------------
  758. :: --------Turn Off Suggested Content in Settings app--------
  759. :: ----------------------------------------------------------
  760. echo --- Turn Off Suggested Content in Settings app
  761. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338393Enabled" /d "0" /t REG_DWORD /f
  762. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-353694Enabled" /d "0" /t REG_DWORD /f
  763. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-353696Enabled" /d "0" /t REG_DWORD /f
  764. :: ----------------------------------------------------------
  765.  
  766.  
  767. :: ----------------------------------------------------------
  768. :: -------------------Disable Windows Tips-------------------
  769. :: ----------------------------------------------------------
  770. echo --- Disable Windows Tips
  771. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableSoftLanding" /t REG_DWORD /d "1" /f
  772. :: ----------------------------------------------------------
  773.  
  774.  
  775. :: Disable Windows Spotlight (random wallpaper on lock screen)
  776. echo --- Disable Windows Spotlight (random wallpaper on lock screen)
  777. reg add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsSpotlightFeatures" /t "REG_DWORD" /d "1" /f
  778. :: ----------------------------------------------------------
  779.  
  780.  
  781. :: ----------------------------------------------------------
  782. :: ----------Disable Microsoft consumer experiences----------
  783. :: ----------------------------------------------------------
  784. echo --- Disable Microsoft consumer experiences
  785. reg add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t "REG_DWORD" /d "1" /f
  786. :: ----------------------------------------------------------
  787.  
  788.  
  789. :: ----------------------------------------------------------
  790. :: -------------Disable Windows Insider Service--------------
  791. :: ----------------------------------------------------------
  792. echo --- Disable Windows Insider Service
  793. PowerShell -ExecutionPolicy Unrestricted -Command "$serviceName = 'wisvc'; Write-Host "^""Disabling service: `"^""$serviceName`"^""."^""; <# -- 1. Skip if service does not exist #>; $service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue; if(!$service) {; Write-Host "^""Service `"^""$serviceName`"^"" could not be not found, no need to disable it."^""; Exit 0; }; <# -- 2. Stop if running #>; if ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) {; Write-Host "^""`"^""$serviceName`"^"" is running, stopping it."^""; try {; Stop-Service -Name "^""$serviceName"^"" -Force -ErrorAction Stop; Write-Host "^""Stopped `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Warning "^""Could not stop `"^""$serviceName`"^"", it will be stopped after reboot: $_"^""; }; } else {; Write-Host "^""`"^""$serviceName`"^"" is not running, no need to stop."^""; }; <# -- 3. Skip if already disabled #>; $startupType = $service.StartType <# Does not work before .NET 4.6.1 #>; if(!$startupType) {; $startupType = (Get-WmiObject -Query "^""Select StartMode From Win32_Service Where Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; if(!$startupType) {; $startupType = (Get-WmiObject -Class Win32_Service -Property StartMode -Filter "^""Name='$serviceName'"^"" -ErrorAction Ignore).StartMode; }; }; if($startupType -eq 'Disabled') {; Write-Host "^""$serviceName is already disabled, no further action is needed"^""; }; <# -- 4. Disable service #>; try {; Set-Service -Name "^""$serviceName"^"" -StartupType Disabled -Confirm:$false -ErrorAction Stop; Write-Host "^""Disabled `"^""$serviceName`"^"" successfully."^""; } catch {; Write-Error "^""Could not disable `"^""$serviceName`"^"": $_"^""; }"
  794. :: ----------------------------------------------------------
  795.  
  796.  
  797. :: ----------------------------------------------------------
  798. :: -----Do not let Microsoft try features on this build------
  799. :: ----------------------------------------------------------
  800. echo --- Do not let Microsoft try features on this build
  801. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PreviewBuilds" /v "EnableExperimentation" /t REG_DWORD /d 0 /f
  802. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PreviewBuilds" /v "EnableConfigFlighting" /t REG_DWORD /d 0 /f
  803. reg add "HKLM\SOFTWARE\Microsoft\PolicyManager\default\System\AllowExperimentation" /v "value" /t "REG_DWORD" /d 0 /f
  804. :: ----------------------------------------------------------
  805.  
  806.  
  807. :: ----------------------------------------------------------
  808. :: --------Disable getting preview builds of Windows---------
  809. :: ----------------------------------------------------------
  810. echo --- Disable getting preview builds of Windows
  811. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PreviewBuilds" /v "AllowBuildPreview" /t REG_DWORD /d 0 /f
  812. :: ----------------------------------------------------------
  813.  
  814.  
  815. :: ----------------------------------------------------------
  816. :: ------Remove "Windows Insider Program" from Settings------
  817. :: ----------------------------------------------------------
  818. echo --- Remove "Windows Insider Program" from Settings
  819. reg add "HKLM\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /v "HideInsiderPage" /t "REG_DWORD" /d "1" /f
  820. :: ----------------------------------------------------------
  821.  
  822.  
  823. :: ----------------------------------------------------------
  824. :: -----------Opt out from Windows privacy consent-----------
  825. :: ----------------------------------------------------------
  826. echo --- Opt out from Windows privacy consent
  827. reg add "HKCU\SOFTWARE\Microsoft\Personalization\Settings" /v "AcceptedPrivacyPolicy" /t REG_DWORD /d 0 /f
  828. :: ----------------------------------------------------------
  829.  
  830.  
  831. :: ----------------------------------------------------------
  832. :: ----Disable active probing (pings to MSFT NCSI server)----
  833. :: ----------------------------------------------------------
  834. echo --- Disable active probing (pings to MSFT NCSI server)
  835. reg add "HKLM\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" /v "EnableActiveProbing" /t REG_DWORD /d "0" /f
  836. :: ----------------------------------------------------------
  837.  
  838.  
  839. :: ----------------------------------------------------------
  840. :: -----------------Disable Windows feedback-----------------
  841. :: ----------------------------------------------------------
  842. echo --- Disable Windows feedback
  843. reg add "HKCU\SOFTWARE\Microsoft\Siuf\Rules" /v "NumberOfSIUFInPeriod" /t REG_DWORD /d 0 /f
  844. reg delete "HKCU\SOFTWARE\Microsoft\Siuf\Rules" /v "PeriodInNanoSeconds" /f
  845. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "DoNotShowFeedbackNotifications" /t REG_DWORD /d 1 /f
  846. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "DoNotShowFeedbackNotifications" /t REG_DWORD /d 1 /f
  847. :: ----------------------------------------------------------
  848.  
  849.  
  850. :: ----------------------------------------------------------
  851. :: ---------Disable text and handwriting collection----------
  852. :: ----------------------------------------------------------
  853. echo --- Disable text and handwriting collection
  854. reg add "HKCU\Software\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d 1 /f
  855. reg add "HKLM\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d 1 /f
  856. reg add "HKCU\Software\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d 1 /f
  857. reg add "HKLM\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d 1 /f
  858. reg add "HKCU\Software\Policies\Microsoft\Windows\HandwritingErrorReports" /v "PreventHandwritingErrorReports" /t REG_DWORD /d 1 /f
  859. reg add "HKLM\Software\Policies\Microsoft\Windows\HandwritingErrorReports" /v "PreventHandwritingErrorReports" /t REG_DWORD /d 1 /f
  860. reg add "HKCU\Software\Policies\Microsoft\Windows\TabletPC" /v "PreventHandwritingDataSharing" /t REG_DWORD /d 1 /f
  861. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\TabletPC" /v "PreventHandwritingDataSharing" /t REG_DWORD /d 1 /f
  862. reg add "HKLM\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "AllowInputPersonalization" /t REG_DWORD /d 0 /f
  863. reg add "HKCU\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d 0 /f
  864. :: ----------------------------------------------------------
  865.  
  866.  
  867. :: ----------------------------------------------------------
  868. :: -----Disable feedback on write (sending typing info)------
  869. :: ----------------------------------------------------------
  870. echo --- Disable feedback on write (sending typing info)
  871. reg add "HKLM\SOFTWARE\Microsoft\Input\TIPC" /v "Enabled" /t REG_DWORD /d 0 /f
  872. reg add "HKCU\SOFTWARE\Microsoft\Input\TIPC" /v "Enabled" /t REG_DWORD /d 0 /f
  873. :: ----------------------------------------------------------
  874.  
  875.  
  876. :: ----------------------------------------------------------
  877. :: -----------Clear previous Windows installations-----------
  878. :: ----------------------------------------------------------
  879. echo --- Clear previous Windows installations
  880. if exist "%SystemDrive%\Windows.old" (
  881.     takeown /f "%SystemDrive%\Windows.old" /a /r /d y
  882.     icacls "%SystemDrive%\Windows.old" /grant administrators:F /t
  883.     rd /s /q "%SystemDrive%\Windows.old"
  884.     echo Deleted previous installation from "%SystemDrive%\Windows.old\"
  885. )  else (
  886.     echo No previous Windows installation has been found
  887. )
  888. :: ----------------------------------------------------------
  889.  
  890.  
  891. :: ----------------------------------------------------------
  892. :: -----------Clear volume backups (shadow copies)-----------
  893. :: ----------------------------------------------------------
  894. echo --- Clear volume backups (shadow copies)
  895. vssadmin delete shadows /all /quiet
  896. :: ----------------------------------------------------------
  897.  
  898.  
  899. pause
  900. exit /b 0
Advertisement
Add Comment
Please, Sign In to add comment