Disable windows update using PureBasic?

Just starting out? Need help? Post your questions and find answers here.
stmdbe2019
User
User
Posts: 89
Joined: Mon Aug 31, 2009 2:11 pm

Disable windows update using PureBasic?

Post by stmdbe2019 »

How to do the same thing in PureBasic for Windows 10 home/pro?

Code: Select all

strComputer = "."  'could be any computer, not just the local one '
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name = 'wuauserv'")

For Each objService in colServiceList
  objService.ChangeStartMode("Disabled")
Next

Const AU_DISABLED = 1

Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
Set objSettings = objAutoUpdate.Settings

objSettings.NotificationLevel = AU_DISABLED
objSettings.Save
-----
Registered PureBasic Coder.
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Disable windows update using PureBasic?

Post by RSBasic »

For example, you can use my library if you want to use WMI: viewtopic.php?f=27&t=70329
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Disable windows update using PureBasic?

Post by RSBasic »

You can also disable the Windows Update services with sc.exe:

Code: Select all

EnableExplicit

;Disable and stop services
RunProgram("sc.exe", "stop wuauserv", "", #PB_Program_Hide | #PB_Program_Wait)
RunProgram("sc.exe", "config wuauserv start= disabled", "", #PB_Program_Hide | #PB_Program_Wait)
RunProgram("sc.exe", "stop BITS", "", #PB_Program_Hide | #PB_Program_Wait)
RunProgram("sc.exe", "sc config BITS start= disabled", "", #PB_Program_Hide | #PB_Program_Wait)

;Enable and start services
;RunProgram("sc.exe", "config BITS start= AUTO", "", #PB_Program_Hide | #PB_Program_Wait)
;RunProgram("sc.exe", "start BITS", "", #PB_Program_Hide | #PB_Program_Wait)
;RunProgram("sc.exe", "config wuauserv start= AUTO", "", #PB_Program_Hide | #PB_Program_Wait)
;RunProgram("sc.exe", "start wuauserv", "", #PB_Program_Hide | #PB_Program_Wait)
(administrator rights required)
Image
Image
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Disable windows update using PureBasic?

Post by VB6_to_PBx »

RSBasic wrote:You can also disable the Windows Update services with sc.exe:

Code: Select all

EnableExplicit

;Disable and stop services
RunProgram("sc.exe", "stop wuauserv", "", #PB_Program_Hide | #PB_Program_Wait)
RunProgram("sc.exe", "config wuauserv start= disabled", "", #PB_Program_Hide | #PB_Program_Wait)
RunProgram("sc.exe", "stop BITS", "", #PB_Program_Hide | #PB_Program_Wait)
RunProgram("sc.exe", "sc config BITS start= disabled", "", #PB_Program_Hide | #PB_Program_Wait)

;Enable and start services
;RunProgram("sc.exe", "config BITS start= AUTO", "", #PB_Program_Hide | #PB_Program_Wait)
;RunProgram("sc.exe", "start BITS", "", #PB_Program_Hide | #PB_Program_Wait)
;RunProgram("sc.exe", "config wuauserv start= AUTO", "", #PB_Program_Hide | #PB_Program_Wait)
;RunProgram("sc.exe", "start wuauserv", "", #PB_Program_Hide | #PB_Program_Wait)
(administrator rights required)
Would that Code also Stop Microsoft Security Essentials anti-virus software from updating Virus definitions ?
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Disable windows update using PureBasic?

Post by RSBasic »

Yes, because the virus definitions are loaded via Windows Update.
But there is a CMD command to load the virus definitions manually: %ProgramFiles%\Microsoft Security Essentials\MpCmdRun.exe -SignatureUpdate
Image
Image
Post Reply