Automatically updating a new windows installation - scripted

AID: 6852
  • Status: Published

1730 points

  • ByMcKnife
  • TypeTutorial
  • Posted on2011-08-07 at 13:22:04
Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting and installing the next updates is not automated.

So that is what this tutorial is about: a script that automates this process, hands and worry free.
To script it, I am not going to use the built-in-windows wuauclt.exe. Although wuauclt has parameters for detection and installation, it is far less practical to use in this case (updating a newly installed computer), just think about how you should determine when to restart... Hence this tutorial.

My script relies on WUInstall.exe which is availabe for free: http://wuinstall.com/index.php/en/free
In short, wuinstall.exe detects, downloads and installs updates using the internal windows mechanisms, it only extends the capabilities.

Prerequisites: Setup your WSUS server and tell the clients about it.
So first, we download wuinstall.exe (included in http://www.hs2n.at/component/option,com_docman/task,doc_download/gid,11/Itemid,90) and we copy it to a certain path, I will use c:\windows. Now create a .bat file with the following content, save it, and use task scheduler to start it using the following parameters:
Executing user: system (password to be left blank)
trigger: at system startup
Task name: wuinstall

 
wuinstall /install
if %errorlevel% EQU 10 goto reboot
if %errorlevel% EQU 2 (goto done) ELSE msg * Something went wrong... please run wuinstall /install interactively
goto end
:reboot
shutdown -f -r -t 00
goto end
:done
msg * Updating completed!
schtasks /delete /tn WUInstall /f
:end
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:

Select allOpen in new window



The script will search for updates and install those and afterwards reboot the computer and start over at next logon until now updates are left. You will be informed by popup if updating is completed or if something went wrong. WUInstall has many more parameters, however most of those are exclusive to the pro version which is not free. For example, you can decide not to install everything your own WSUS offers but only patches with severity critical or drivers only. http://wuinstall.com/images/folder/WuInstall_on1page_free.pdf tells you on one page what options you have with the free version and what features would require going pro.
.
Asked On
2011-08-07 at 13:22:04ID6852
Tags

WSUS

,

WUInstall

,

Automation

,

deployment

Topic

Microsoft Operating Systems

Views
1119

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Microsoft OS Experts

  1. arnold

    239,189

    Guru

    2,000 points yesterday

    Profile
    Rank: Genius
  2. ve3ofa

    139,946

    Master

    30 points yesterday

    Profile
    Rank: Genius
  3. Run5k

    101,519

    Master

    1,332 points yesterday

    Profile
    Rank: Genius
  4. motnahp00

    92,068

    Master

    6,000 points yesterday

    Profile
    Rank: Sage
  5. hanccocka

    83,646

    Master

    0 points yesterday

    Profile
    Rank: Genius
  6. dariusg

    77,577

    Master

    1,068 points yesterday

    Profile
    Rank: Genius
  7. Anuroopsundd

    68,818

    Master

    0 points yesterday

    Profile
    Rank: Sage
  8. thinkpads_user

    67,882

    Master

    1,500 points yesterday

    Profile
    Rank: Genius
  9. nobus

    64,444

    Master

    0 points yesterday

    Profile
    Rank: Savant
  10. demazter

    60,050

    Master

    252 points yesterday

    Profile
    Rank: Genius
  11. leew

    57,521

    Master

    0 points yesterday

    Profile
    Rank: Savant
  12. Darr247

    56,589

    Master

    1,000 points yesterday

    Profile
    Rank: Genius
  13. dstewartjr

    39,728

    668 points yesterday

    Profile
    Rank: Genius
  14. kevinhsieh

    36,520

    0 points yesterday

    Profile
    Rank: Genius
  15. CrisHanna_MVP

    34,183

    0 points yesterday

    Profile
    Rank: Genius
  16. l33tf0b

    33,900

    0 points yesterday

    Profile
    Rank: Wizard
  17. rindi

    32,637

    1,200 points yesterday

    Profile
    Rank: Savant
  18. als315

    29,824

    0 points yesterday

    Profile
    Rank: Genius
  19. cwstad2

    28,405

    0 points yesterday

    Profile
    Rank: Guru
  20. BillDL

    27,255

    0 points yesterday

    Profile
    Rank: Genius
  21. jcimarron

    26,929

    0 points yesterday

    Profile
    Rank: Genius
  22. oBdA

    25,773

    0 points yesterday

    Profile
    Rank: Savant
  23. mpfister

    25,600

    0 points yesterday

    Profile
    Rank: Genius
  24. Callandor

    25,390

    2,000 points yesterday

    Profile
    Rank: Genius
  25. noxcho

    25,075

    0 points yesterday

    Profile
    Rank: Genius

Hall Of Fame