Cogger

I0-Services-Modifications.ps1

Jun 13th, 2022
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ########################################################################################################################
  2. #=====[ Services ]=====#
  3. ########################################################################################################################
  4.  
  5. # Disable Service Known to cause issues
  6. $Services = @(
  7.  
  8. # unnecessary services
  9. "sysmain"
  10. "WpnService"
  11. "WSearch"
  12. "DiagTrack"
  13. "diagnosticshub.standardcollector.service"
  14. "ClicktoRunSvc"
  15. "dmwappushservice"
  16. "HomeGroupListener"
  17. "HomeGroupProvider"
  18. "RetailDemo"
  19. "lfsvc"
  20. "MapsBroker"
  21. "OneSyncSvc"
  22. "XblAuthManager"
  23. "XblGameSave"
  24. "XboxNetApiSvc"
  25. "WerSvc"
  26.  
  27. )
  28. foreach ($Service in $Services) {
  29. Set-Service -Name $Service -StartupType Disabled -EA SilentlyContinue
  30. Write-Host "Setting $Service to disabled."
  31.  
  32. Stop-Service -Name $Service -Force -Confirm:$false -EA SilentlyContinue
  33. Write-Host "Stopping $Service..."
  34.  
  35. }
  36.  
  37. #Disabling the Diagnostics Tracking Service
  38. cmd /c sc delete DiagTrack -EA SilentlyContinue
  39. cmd /c sc delete dmwappushservice -EA SilentlyContinue
  40. cmd /c sc delete diagnosticshub.standardcollector.service -EA SilentlyContinue
  41.  
  42. #  Ensure Windows Update services are started properly.
  43. $UpdateServices= @(
  44.  
  45. # Update Services
  46. "wuauserv"
  47. "bits"
  48.  
  49.  
  50. )
  51. foreach ($UpdateService in $UpdateServices) {
  52. Stop-Service -Name $UpdateService -Force -Confirm:$false -EA SilentlyContinue
  53. Write-Host "Stopping $UpdateService..."
  54.  
  55. Set-Service -Name $UpdateService -StartupType Automatic
  56. Write-Host "Setting $UpdateService to automatic."
  57.  
  58. Start-Service  -Name $UpdateService
  59. Write-Host "Starting $UpdateService..."}
  60.  
  61. ### Kill Windows Search UI
  62. Stop-Process -Name "SearchUi.exe" -Force -EA SilentlyContinue
  63. $Currentlocation = (Get-Location).path
  64. cd $env:windir\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy
  65. takeown /f SearchUI.exe
  66. icacls SearchUI.exe /grant administrators:F
  67. Stop-Process -Name "SearchUi.exe" -Force -EA SilentlyContinue
  68. cmd /c rename SearchUI.exe SearchUI.exe.001
  69. cd $Currentlocation
  70.  
Advertisement
Add Comment
Please, Sign In to add comment