Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Script LOCAL pc windows updates on gpedit.msc

Posted on 2012-04-02
3
Medium Priority
?
658 Views
Last Modified: 2012-04-13
Hello Experts, I need a local only script that will modify the gpedit.msc for windows updates to do the following:

Computer/Configuration/Administrative Templates/Windows Components/ Windows Updates.  
setting 1--> Configure auto update (option 4)
setting 2--> No auto restart with logged in user
0
Comment
Question by:tfgeorge
  • 2
3 Comments
 
LVL 21

Accepted Solution

by:
motnahp00 earned 1500 total points
ID: 37797134
A co-worker gave me this a while back:

Dim WSHShell
'Create the wscript Shell object, which contains the Registry methods
Set WSHShell = wscript.CreateObject("wscript.Shell")

'*** Stop the Automatic Updates service *****************

WSHShell.Run "net stop wuauserv"
Wscript.Sleep 10000

'********************************************************
'***** Set Automatic Updates start type to Automatic ************

WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\wuauserv\start", 2,
"REG_DWORD"
Wscript.Sleep 5000

'*********************************************************
'**** Configure settings for Automatic Updates *******************

WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoA
utoUpdate", 0, "REG_DWORD"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\AUO
ptions", 4, "REG_DWORD"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\Sch
eduledInstallDay", 0, "REG_DWORD"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\Sch
eduledInstallTime", 6, "REG_DWORD"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\Use
WUServer", 1, "REG_DWORD"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoA
utoRebootWithLoggedOnUsers", 1, "REG_DWORD"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\Res
cheduleWaitTime", 1, "REG_DWORD"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\WUServ
er", "http://yourserver", "REG_SZ"
WSHShell.RegWrite
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\WUStat
usServer", "http://yourserver", "REG_SZ"

'*******************************************************
'******** Start the Automatic Updates service *****************

WSHShell.Run "net start wuauserv"
Wscript.Sleep 10000

'*********************************************

strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery ("Select * from
Win32_Service")
For Each objService in colRunningServices
 if objService.DisplayName = "Automatic Updates" then
     if objService.State = "Stopped" then
       wscript.echo "Automatic Updates have been configured. You must
Reboot your computer for the settings to take place."
     else
       wscript.echo "Automatic Updates have been configured."
     end if
 end if
Next

wscript.Quit(0)
0
 
LVL 21

Expert Comment

by:motnahp00
ID: 37797144
I have noticed that scripts regarding Windows Update settings do not seem to appear in gpedit.msc even though things are working properly.
0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 37797660
Why not then use something like wuinstall ??


http://wuinstall.com/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question