rodent1 Posted April 15, 2015 Posted April 15, 2015 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, . 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? 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 . Of course, you don't want this running all the time ... 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now