severen1999

End Services

Aug 16th, 2020
1,823
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #RequireAdmin ;Requires Script With Administrator Rights for Stopping Services
  2.  
  3. #cs ----------------------------------------------------------------------------
  4.     AutoIt Version: v3.3.14.5
  5.     Author:      SevWren
  6.     Requirements:    Only Confirmed in Windows 10x64
  7.     Script Function: Stop Services every 10 minutes
  8. #ce ----------------------------------------------------------------------------
  9.  
  10. ;Define and Assign user input to variables
  11.  
  12. ;~ $result = RunWait(@ComSpec & " /c pause", @ScriptDir, @SW_MAXIMIZE)
  13. Global $Windows = InputBox("", "Turn Off Update Crap?", "y/n")
  14. Global $MiscCrap = InputBox("", "Turn Misc Crap?", "y/n")
  15.  
  16. While 1 = 1 ;do functions based on $Windows & $MiscCrap input
  17.     If $Windows = "y" Or $Windows = "Y" Then
  18.         _StopWinUpdateServices() ;goto _StopWinUpdateServices function
  19.     EndIf
  20.     If $MiscCrap = "y" Or $MiscCrap = "Y" Then
  21.         _StopMiscCrap() ;goto _StopMiscCrap() function
  22.     EndIf
  23.     Sleep(600000) ;do nothing for 10 minutes
  24. WEnd
  25.  
  26.  
  27. Func _StopWinUpdateServices() ;Stop Services
  28.     ;$result returns 0 = Success, 2 = Already Stopped / Started
  29.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update"', @ScriptDir, @SW_HIDE)
  30.     $result = RunWait(@ComSpec & " /c net stop " & '"Background Intelligent Transfer Service"', @ScriptDir, @SW_HIDE)
  31.     $result = RunWait(@ComSpec & " /c net stop " & '"Update Orchestrator Service"', @ScriptDir, @SW_HIDE)
  32.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update Medic Service"', @ScriptDir, @SW_HIDE)
  33.     $result = RunWait(@ComSpec & " /c net stop " & '"Workstation"', @ScriptDir, @SW_HIDE)
  34.     $result = RunWait(@ComSpec & " /c net stop " & '"TCP/IP NetBIOS Helper"', @ScriptDir, @SW_HIDE)
  35.     $result = RunWait(@ComSpec & " /c net stop server", @ScriptDir, @SW_HIDE)
  36. EndFunc   ;==>_StopWinUpdateServices
  37.  
  38. Func _StopMiscCrap()         ;crappy services good to stop. shouldn't be perm "disabled"
  39.     $result = RunWait(@ComSpec & " /c net stop " & '"SSDP Discovery"', @ScriptDir, @SW_HIDE)
  40.     $result = RunWait(@ComSpec & " /c net stop " & '"Clipboard User Service_b5784"', @ScriptDir, @SW_HIDE)
  41.     $result = RunWait(@ComSpec & " /c net stop " & '"Contact Data_b5784"', @ScriptDir, @SW_HIDE)
  42.     $result = RunWait(@ComSpec & " /c net stop " & '"Sync Host_b5784"', @ScriptDir, @SW_HIDE)
  43.     $result = RunWait(@ComSpec & " /c net stop " & '"Quality Windows Audio Video Experience"', @ScriptDir, @SW_HIDE)
  44.  
  45. EndFunc   ;==>_StopMiscCrap
  46.  
  47. #cs
  48. ;Notes for future addition to offer turning services on if needbe
  49. Func _TurnOnStuff() ;starts all services stopped previously
  50.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update"', @ScriptDir, @SW_HIDE)
  51.     $result = RunWait(@ComSpec & " /c net stop " & '"Background Intelligent Transfer Service"', @ScriptDir, @SW_HIDE)
  52.     $result = RunWait(@ComSpec & " /c net stop " & '"Update Orchestrator Service"', @ScriptDir, @SW_HIDE)
  53.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update Medic Service"', @ScriptDir, @SW_HIDE)
  54.     $result = RunWait(@ComSpec & " /c net stop " & '"Workstation"', @ScriptDir, @SW_HIDE)
  55.     $result = RunWait(@ComSpec & " /c net stop " & '"TCP/IP NetBIOS Helper"', @ScriptDir, @SW_HIDE)
  56.     $result = RunWait(@ComSpec & " /c net stop server", @ScriptDir, @SW_HIDE)
  57.     $result = RunWait(@ComSpec & " /c net stop " & '"SSDP Discovery"', @ScriptDir, @SW_HIDE)
  58.     $result = RunWait(@ComSpec & " /c net stop " & '"Clipboard User Service_b5784"', @ScriptDir, @SW_HIDE)
  59.     $result = RunWait(@ComSpec & " /c net stop " & '"Contact Data_b5784"', @ScriptDir, @SW_HIDE)
  60.     $result = RunWait(@ComSpec & " /c net stop " & '"Sync Host_b5784"', @ScriptDir, @SW_HIDE)
  61. EndFunc   ;==>_TurnOnStuff
  62. #ce
RAW Paste Data