Question : Setting automatic updates on windows 7 with VBS

Hi,
I'm using the code below to set Automatic Updates and it works on my Windows XP test machines.  When I run in on my Windows 7 test machines though it kicks an error of "The specified network resource or device is no longer available" at Line 14 objSettings.NotificationLevel = AU_ENABLE.

I've searched around and I can't find a different way to do it.  Is there a new way with Windows 7 or Vista?

Thanks,
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
	
	Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'wuauserv'")
	
	For Each objService in colServiceList
	  objService.StartService()
	  objService.ChangeStartMode("Automatic")
	Next
	
	Const AU_ENABLE = 4
	
	Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
	Set objSettings = objAutoUpdate.Settings
	objSettings.NotificationLevel = AU_ENABLE
	objSettings.Save

Answer : Setting automatic updates on windows 7 with VBS

Hi,

  If you run this as administrator it will work. While I got a different error when running on my machine - it did work when running as admin.
Random Solutions  
 
programming4us programming4us