Jump to content

stop windows update service automatically


rodent1
 Share

Recommended Posts

Trying to finish something, but every time you turn around, the windows update services prompts you to reboot? This morning I was in the middle of typing, and the reboot dialog stole the focus, accepted a keyboard enter command, and started rebooting, :censored: . One way is to just turn off the service. But then, the network admin automatically turns it back on every few minutes. Tired of it? :zorro:  Here is a small script that will check every 30 seconds to see if it's running, and if it is, will turn it off  :pirate: . Of course, you don't want this running all the time o:) ...

Dim $Services
Dim $ServicesList

While 1
    CheckService()
    Sleep(30000)    ; sleep 30 seconds
WEnd


Func CheckService()
    $ServiceName = "wuauserv"
    Local $Services = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
    Local $ServicesList = $Services.ExecQuery("SELECT * FROM Win32_Service")
    If IsObj($ServicesList) then
        For $Services in $ServicesList
            If $Services.Name = $ServiceName Then
                if $Services.State = "Running" Then
                    Run (@ComSpec & " /c " & 'net stop wuauserv')
                EndIf
            EndIf
        Next
    EndIf
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...