Advertisement
severen1999

Stop Windows 10 services

May 29th, 2020
2,547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.39 KB | None | 0 0
  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. Global $Windows = InputBox("", "Turn Off Update Crap?", "y/n")
  12. Global $MiscCrap = InputBox("", "Turn Misc Crap?", "y/n")
  13.  
  14. While 1 = 1 ;do functions based on $Windows & $MiscCrap input
  15.     If $Windows = "y" Or $Windows = "Y" Then
  16.         _StopWinUpdateServices() ;goto _StopWinUpdateServices function
  17.     EndIf
  18.     If $MiscCrap = "y" Or $MiscCrap = "Y" Then
  19.         _StopMiscCrap() ;goto _StopMiscCrap() function
  20.     EndIf
  21.     Sleep(600000) ;do nothing for 10 minutes
  22. WEnd
  23.  
  24. Func _StopWinUpdateServices() ;Stop Services
  25.     ;$result returns 0 = Success, 2 = Already Stopped / Started
  26.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update"', @ScriptDir, @SW_HIDE)
  27.     $result = RunWait(@ComSpec & " /c net stop " & '"Background Intelligent Transfer Service"', @ScriptDir, @SW_HIDE)
  28.     $result = RunWait(@ComSpec & " /c net stop " & '"Update Orchestrator Service"', @ScriptDir, @SW_HIDE)
  29.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update Medic Service"', @ScriptDir, @SW_HIDE)
  30.     $result = RunWait(@ComSpec & " /c net stop " & '"Workstation"', @ScriptDir, @SW_HIDE)
  31.     $result = RunWait(@ComSpec & " /c net stop " & '"TCP/IP NetBIOS Helper"', @ScriptDir, @SW_HIDE)
  32.     $result = RunWait(@ComSpec & " /c net stop server", @ScriptDir, @SW_HIDE)
  33. EndFunc   ;==>_StopWinUpdateServices
  34.  
  35. Func _StopMiscCrap()         ;crappy services good to stop. shouldn't be perm "disabled"
  36.     $result = RunWait(@ComSpec & " /c net stop " & '"SSDP Discovery"', @ScriptDir, @SW_HIDE)
  37.     $result = RunWait(@ComSpec & " /c net stop " & '"Clipboard User Service_b5784"', @ScriptDir, @SW_HIDE)
  38.     $result = RunWait(@ComSpec & " /c net stop " & '"Contact Data_b5784"', @ScriptDir, @SW_HIDE)
  39.     $result = RunWait(@ComSpec & " /c net stop " & '"Sync Host_b5784"', @ScriptDir, @SW_HIDE)
  40. EndFunc   ;==>_StopMiscCrap
  41.  
  42. #cs
  43. ;Notes for future addition to offer turning services on if needbe
  44. Func _TurnOnStuff() ;starts all services stopped previously
  45.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update"', @ScriptDir, @SW_HIDE)
  46.     $result = RunWait(@ComSpec & " /c net stop " & '"Background Intelligent Transfer Service"', @ScriptDir, @SW_HIDE)
  47.     $result = RunWait(@ComSpec & " /c net stop " & '"Update Orchestrator Service"', @ScriptDir, @SW_HIDE)
  48.     $result = RunWait(@ComSpec & " /c net stop " & '"Windows Update Medic Service"', @ScriptDir, @SW_HIDE)
  49.     $result = RunWait(@ComSpec & " /c net stop " & '"Workstation"', @ScriptDir, @SW_HIDE)
  50.     $result = RunWait(@ComSpec & " /c net stop " & '"TCP/IP NetBIOS Helper"', @ScriptDir, @SW_HIDE)
  51.     $result = RunWait(@ComSpec & " /c net stop server", @ScriptDir, @SW_HIDE)
  52.     $result = RunWait(@ComSpec & " /c net stop " & '"SSDP Discovery"', @ScriptDir, @SW_HIDE)
  53.     $result = RunWait(@ComSpec & " /c net stop " & '"Clipboard User Service_b5784"', @ScriptDir, @SW_HIDE)
  54.     $result = RunWait(@ComSpec & " /c net stop " & '"Contact Data_b5784"', @ScriptDir, @SW_HIDE)
  55.     $result = RunWait(@ComSpec & " /c net stop " & '"Sync Host_b5784"', @ScriptDir, @SW_HIDE)
  56. EndFunc   ;==>_TurnOnStuff
  57. #ce
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement