troubleshooting Question

How can i run windows udpates strictly from the registry

Avatar of BLACK THANOS
BLACK THANOSFlag for United States of America asked on
Windows BatchShell ScriptingMicrosoft Server OSWindows 7
18 Comments4 Solutions1011 ViewsLast Modified:
Good evening experts,

I have asked this question in the past ,but I am asking it in a different way this time. I have a script that I have written in primal script to modify, add, or delete registry keys or subkeys.

(disclaimer: always backup the registry before attempting to script via programming tools).

My goal is to automate and control the running of Windows Updates. Before I continue, here are some things you should be aware of before attempting to answer my question:

1.

I am in a WORKGROUP environment

2.

I don't have access to Active Directory

3.

I cant use Group Policy

4.

My machine are all Windows 7 Professional

5.

We are a NonProfit organization, so resources are scarce

6.

Cant buy third party solution, although I do use deepfreeze

7.

DeepFreeze handles critical and security updates

8.

I am only concerned with important and optional updates

With those stipulations said, I have tried a number of options to do windows updates for me. Those options are:

1.

The free version of Wuinstall

2.

Autopatcher

3.

Windows Update Catalog

4.

Still playing with WUC

5.

Portable Update
you get the picture. Now I am trying to do this via the registry. this is the code snippet that I am using:

'""""""""""""""""""""""""""""""""""""""""""""""""""""""
' Value: NoAutoUpdate
' 
' 0 - Enable Automatic Updates (Default)
' 1 - Disable Automatic Updates
'""""""""""""""""""""""""""""""""""""""""""""""""""""""

strEntryName = "NoAutoUpdate"
WScript.Echo "strEntryName: " & strEntryName
dwValue = 0
WScript.Echo "dwValue: " & dwValue
StdRegProv.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,dwValue


'""""""""""""""""""""""""""""""""""""""""""""""""""""""
' Value: AUOptions
' 
' 2 - Notify for download and notify for install
' 3 - Auto download and notify for install
' 4 - Auto download and schedule the install
'""""""""""""""""""""""""""""""""""""""""""""""""""""""

strEntryName = "AUOptions"
WScript.Echo "strEntryName: " & strEntryName
dwValue = 4
WScript.Echo "dwValue: " & dwValue
StdRegProv.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,dwValue

'""""""""""""""""""""""""""""""""""""""""""""""""""""""
' Value: ScheduledInstallDay
' 
' 0 - Install every day
' 1 to 7 - Install on specific day of the week from Sunday (1) to Saturday (7).
' Sunday - 1 , Monday - 2 , Tuesday - 2 ,  Wednesday - 4, Thursday - 5
' Friday - 6, Saturday - 7

'""""""""""""""""""""""""""""""""""""""""""""""""""""""

strEntryName = "ScheduledInstallDay"
WScript.Echo "strEntryName: " & strEntryName
dwValue = 4
WScript.Echo "dwValue: " & dwValue
StdRegProv.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,dwValue


'""""""""""""""""""""""""""""""""""""""""""""""""""""""
'  Value name: ScheduledInstallTime
'  Value data: n, where n equals the time of day in a 24-hour format (0-23).
'  Registry Value Type: Reg_DWORD
''""""""""""""""""""""""""""""""""""""""""""""""""""""""

' 0	    0:00	12:00 AM
' 1	    1:00	1:00 AM
' 2  	2:00	2:00 AM
' 3	    3:00	3:00 AM
' 4  	4:00	4:00 AM
' 5	    5:00	5:00 AM
' 6     6:00	6:00 AM
' 7	    7:00	7:00 AM
' 8 	8:00	8:00 AM
' 9  	9:00	9:00 AM
' 10	10:00	10:00 AM
' 11	11:00	11:00 AM
' 12	12:00	12:00 PM
' 13	13:00	1:00 PM
' 14	14:00	2:00 PM
' 15	15:00	3:00 PM
' 16	16:00	4:00 PM
' 17	17:00	5:00 PM
' 18	18:00	6:00 PM
' 19	19:00	7:00 PM
' 20	20:00	8:00 PM
' 21	21:00	9:00 PM
' 22	22:00	10:00 PM
' 23	23:00	11:00 PM
'""""""""""""""""""""""""""""""""""""""""""""""""""""""

strEntryName = "ScheduledInstallTime"
WScript.Echo "strEntryName: " & strEntryName
dwValue = 18
WScript.Echo "dwValue: " & dwValue
StdRegProv.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,dwValue


strEntryName = "ScheduledInstallDate"
WScript.Echo "strEntryName: " & strEntryName
strValue = "2013-07-03 18:28:00"
WScript.Echo "strValue: " & strValue
StdRegProv.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue


The script worked but didn't launch windows updates. I just ran it again, but this time I delete the "Auto Update" subkey and recreated it in the script and this is what I got:


!
I would have thought to see the icon:

!



but alas,

I am flubbed again.  Please shed some light on this issue.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 4 Answers and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros