Jump to content

unattended windows update


Recommended Posts


Maybe he's thinking about sending it to someone who might not install it for a month or two. I did that, so I understand. Of course you slipstream to make t as up-to-date as possible, but one of the things you do it for is to save time in the future. If you are constantly preparing new versions, then you're not saving much time at all.

I like to keep up-to-date and fiddle, but I know many don't. They want to set it up and then only use it when they need it. If it auto updates, all the better.

Now, I thought of a way you might do that, but it is not completely clear in my mind yet. First you have to be connected. Second you'll need to set the Automatic updates in the security center set to On. Then, you should be able to invoke the service through RunOnceEx on first or even second reboot.

Now, offhand I can't think of how to set the AutoUpdates to On, but I'm sure there is a way. If I find it, I'll try to get back to this thread! :o)

Cheers,

Link to comment
Share on other sites

  • 1 month later...

russ9898:

That is one way to do it yea:

Only you need to include one line at the top, copy paste the following to notepad and save as .reg. launch silently with regedit /s filename.reg.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update]
"AUOptions"=dword:00000004

Link to comment
Share on other sites

If you set AUOptions to 4 you must also set ScheduledInstallDay and ScheduledInstallTime

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update]
"AUOptions"=dword:00000004
"ScheduledInstallDay"=dword:00000000
"ScheduledInstallTime"=dword:00000003

Link to comment
Share on other sites

Here is a cmd file that will do it all for you in one go... has been tried and tested :D

@echo off
:: Here is a quick way to split the date into parts.
:: Supports yyyy-dd-mm, yyyy-mm-dd, mm-dd-yyyy, and dd-mm-yyyy,
:: doesn't rely on dashes vs slashes.

for /f "tokens=2,*" %%d in ("%date%") do set today=%%d

echo. | date | find "(yy" > nul
if !%errorlevel%!==!0! (
set year=%today:~0,4%
echo. | date | find "mm)" > nul
if !%errorlevel%!==!0! (
set month=%today:~-2%
set day=%today:~-5,2%
) else (
set month=%today:~-5,2%
set day=%today:~-2%
)
) else (
set year=%today:~-4%
echo. | date | find "(mm" > nul
if !%errorlevel%!==!0! (
set month=%today:~0,2%
set day=%today:~3,2%
) else (
set month=%today:~3,2%
set day=%today:~0,2%
)
)

:: Write the registy file for import with the correct date and time

echo Windows Registry Editor Version 5.00 > %tmp%\wuset.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update] >> %tmp%\wuset.reg

:: Change this option below to what you want your configuration to be...
:: dword:00000004 = Automatic (recommended)
:: dword:00000003 = Download updates for me, but let me choose when to install them.
:: dword:00000002 = Notify me but don't automatically download or install them
:: dword:00000004 = Turn off Automatic Updates (not recommended!)
echo "AUOptions"=dword:00000004 >> %tmp%\wuset.reg

echo "ConfigVer"=dword:00000001 >> %tmp%\wuset.reg

:: You can change the default time for checking from 3am (below and default) to what you like...
echo "NextDetectionTime"="%year%-%month%-%day% 03:00:00" >> %tmp%\wuset.reg
echo "ScheduledInstallDate"="%year%-%month%-%day% 03:00:00" >> %tmp%\wuset.reg
echo "ScheduledInstallDay"=dword:00000000 >> %tmp%\wuset.reg
echo "ScheduledInstallTime"=dword:00000003 >> %tmp%\wuset.reg
echo "SetupWizardLaunchTime"=- >> %tmp%\wuset.reg

:: Now apply the correct settings to the registry
regedit /s "%tmp%\wuset.reg"

:: Clean-up - Delete the reg file after use
del /f /q "%tmp%\wuset.reg"

Enjoy :D

Edited by `Felix`
Link to comment
Share on other sites

Felix, I have a few issues with your script. After each detection AU sets the next detection to a random time between 16.5 and 22 hours forward so the NextDetectionTime value is unneeded. The ScheduledInstallDate value is set after an update has been downloaded and has no effect of there are no updates waiting to be installed. Deleting the SetupWizardLaunchTime value is not needed because the AU client deletes this key if AUOptions is anything other than 0.

If you want a script here's a much cleaner script:

NET STOP "Automatic Updates"
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions REG_DWORD /d 00000004
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v ScheduledInstallDay REG_DWORD /d 00000000
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v ScheduledInstallTime REG_DWORD /d 00000003
NET START "Automatic Updates"
WUAUCLT /DETECTNOW

My script also restarts the service so the changes take effect and forces a detection and doesn't need any temporary files.

Link to comment
Share on other sites

Felix, I have a few issues with your script. After each detection AU sets the next detection to a random time between 16.5 and 22 hours forward so the NextDetectionTime value is unneeded. The ScheduledInstallDate value is set after an update has been downloaded and has no effect of there are no updates waiting to be installed. Deleting the SetupWizardLaunchTime value is not needed because the AU client deletes this key if AUOptions is anything other than 0.

If you want a script here's a much cleaner script:

NET STOP "Automatic Updates"
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions REG_DWORD /d 00000004
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v ScheduledInstallDay REG_DWORD /d 00000000
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v ScheduledInstallTime REG_DWORD /d 00000003
NET START "Automatic Updates"
WUAUCLT /DETECTNOW

My script also restarts the service so the changes take effect and forces a detection and doesn't need any temporary files.

Good stuff and thanks for the clarification. I was just doing some checking of the registry as i made changes manually and put the script together based on that... Always happy to be wrong, as long as i learn from the mistakes :D

I will give your script a test this evening.

Link to comment
Share on other sites

For those that want to tweak AU, here are a few more registry values (all are type dword defaults are in red)

AutoInstallMinorUpdates (0,1) specifies that AU should immediatly install updates that never require a reboot without promping the user or waiting for the scheduled install time

DetectionFrequency (1-22) specifies how often in hours AU checks for updates (actual time will be a random interval between 75% and 100% of the value)

DetectionFrequencyEnabled (0,1) must be set to 1 to use the previous setting

RebootWarningTimeout (1-30,5) specifies in minutes how long the countdown window is shown before an automatic reboot

RebootWarningTimeoutEnabled (0,1) must be set to 1 to use the previous setting

NoAutoRebootWithLoggedOnUsers (0,1)

RebootRelaunchTimeout (1-1440,10) specifies how often in minutes a user will be prompted to restart the computer

RebootRelaunchTimeoutEnabled (0,1) must be set to 1 to use the previous setting

RescheduleWaitTime (1-60) specifies how long in minutes to wait before installing if the computer was turned off at the scheduled install time (if this is not set missed updates will be installed at the next scheduled install time)

RescheduleWaitTimeEnabled (0,1) must be set to 1 to use the previous setting

Link to comment
Share on other sites

I don't see why you need to set ScheduledInstallDay and ScheduledInstallTime as the default value is already 0 and 3.

These default values are created by the control panel applet, these are not the default values that will be used if the values are absent. These values do not exist on a fresh install of Windows.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...