Script LOCAL pc windows updates on gpedit.msc

Posted on 2012-04-02
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
Question by:tfgeorge
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 21

Accepted Solution

motnahp00 earned 500 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 ************

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

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

utoUpdate", 0, "REG_DWORD"
ptions", 4, "REG_DWORD"
eduledInstallDay", 0, "REG_DWORD"
eduledInstallTime", 6, "REG_DWORD"
WUServer", 1, "REG_DWORD"
utoRebootWithLoggedOnUsers", 1, "REG_DWORD"
cheduleWaitTime", 1, "REG_DWORD"
er", "http://yourserver", "REG_SZ"
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
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."
       wscript.echo "Automatic Updates have been configured."
     end if
 end if

LVL 21

Expert Comment

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.
LVL 47

Expert Comment

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

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

So many times I have seen the words written in a question "if only I could show you" or " I know how hard it is for you since you can't see it" in any zone. That has inspired me to write about this tool in windows 7 called "Problem Steps Recorder…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

739 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