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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
laptop problem 21 96
Delete out x file types from multiple network directories using batch script 8 53
gparted boot manager 4 44
Oracle VM ware 7 43
One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now