Jump to content

Recommended Posts

You are posting in the wrong forum! Did you read the title?

"A forum to share your cool scripts, User Defined Functions and AutoIt-based applications with others. This is NOT a general support forum!"

Use the "General Help and Support forum".

My UDFs and Tutorials:


Active Directory (NEW 2021-11-10 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-11-16 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version - Download
Outlook Tools (2019-07-22 - Version - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki
WebDriver - Wiki


Link to post
Share on other sites
  • Moderators


Please pay attention where you are posting in future - I will move it for you this time. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Link to post
Share on other sites
  • Moderators

What OS are you wanting to run Windows Update for, XP or Win 7? The process is very different. Here is a I did some time ago for XP, might give you a nudge in the right direction.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites

Might be of help. Takes a set of Windows patches in a subdir named by OS version, and applies them, optionally silently.

Currently only does Windows updates. Office updates could be pulled from a second folder I suppose, if needed.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=LAN Software Updater
#AutoIt3Wrapper_Res_LegalCopyright=GPL, IWR Consultancy
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; ***********************************************************************
; Small Network Systems Update Server.
; A simple Windows security-patch deployment script for small networks.
; Caters for multiple OS versions, each having its own source-folder.
; Installs patches silently when possible to avoid user-hassle.
; Usage: Compile with Autoit 3.1+ and place in any suitable location.
; Make one or more subfolders, whose names must match the (AutoIt)
; ID for the OS versions to be patched, e.g WIN_2000, WIN_XP
; Get patches using the administrator mode of Windows Update.
; Place the required patches in each folder.
; MS Office 2003 patches are now catered-for.
; Other non-Microsoft executables can also be included where suitable.
; Call from the logon script, or launch with a startup shortcut.
; Limitations: Must be run under an account with local-admin priveleges.
; Status: Production, stable.
; Copyright IWR Consultancy Jan 2006, this version Aug 2011.
; iwrconsultancy.co.uk
; Supplied under the terms of the GNU Public Licence v3.
; May be distributed and used freely.
; ***********************************************************************
; Determine OS running, and appropriate patch-folder:
; opt("RunErrorsFatal",0)
$IniFile=@ScriptDir & '\sus.ini'
$PatchFolder=@ScriptDir & '\' & $OSPatchFolder
; You might want to put the logs on a server share for easier checking,
; by default they're in the Windows/WINNT folder.
$patchlog= $PatchLogDir & '\' & @computername &  '_Patchlog.txt'
; Check for commandline switches:
; doFailed=Repeat the failures (and do new)
; doAll=Repeat whole sequence, missing none.
$Processname=IniRead($iniFile,"General","ProcessName","IWRConsultancy System Patch Installer")
$dlgComment=IniRead($iniFile,"General","Comment","Security patches are available for your computer.")
$inhibit = stringsplit($inhibit,",|;: ")
case $interaction=0
; As near to silent operation as possible.
case $interaction=1
; Ask user at startup only, try to remain 'silent' thereafter.
case else
; Ask at start/when reboot needed, give feedback via tray icon.
if $cmdLine[0]>0 then
if StringInStr($cmdLine[1],"/f") then
if StringInStr($cmdLine[1],"/a") then
; Enumerate patch folder:
$_pathtoscan = $PatchFolder & '\*.exe'
$_spSearch = FileFindFirstFile ( $_pathtoscan )
If $_spSearch = -1 Then
   ;  MsgTip(0, "PatchError", "No patches found for this OS")
; Main Loop:
While 1
; Get a file in the patch folder
$file = FileFindNextFile($_spSearch)
If @error Then ExitLoop
; See if the patch has been installed already, and if the install was a success:
; (Patches get two tries at installing, after which they're flagged as bad)
$logentry = IniRead ($patchlog,'Installed',$file,-1)
if $doAll=0 then
if $logentry = 'Success' then continueloop ; Installed previously.
if $logentry = 'Manual' then continueloop ; Hopefuly installed manually.
if $logentry = 'RebootSuccess' then continueloop ; Installed, reboot needed. No need to repeat.
if $doFailed=0 then
  if $logentry = 'Failed' then continueloop ; Repeated failure, so stop trying.
for $ict = 1 to $inhibit[0]
if stringinstr($file,$inhibit[$ict]) > 0  then
  IniWrite ($patchlog,'Installed',$file,'Inhibited')
  continueloop 2
$PatchPath = $PatchFolder & '\' & $file
; Make a shortname for the Tray Tip:
if $kbpos > 0 then
if $chars < 1 then $chars = stringlen($shortname)
$shortname= stringmid($shortname,$kbpos,$chars)
; We do recent Win2000 and Windows XP KBnnnn patches silently.
; Earlier W2000 patches are too varied in switch syntax for any consistent method,
; so in this case we just let the user do the clicking.
; Names of the 'silent-capable' patches start with the word 'Windows' and contain the strings '-kb' and '-x86'
; Here I'm just testing for 'Windows' which seems adequate.

case $silent=0
  $switches= ''
case stringleft($file,7)='windows'
  $switches= ' /Q /Z /M'
case stringleft($file,6)='office'
  $switches= ' /Q'
case else
  $switches= ''
if $interaction > 0 then TrayTip ($ProcessName,'Installing Security Update: ' & $shortname & '  ',5)
; Ask user if it's OK to patch computer just now:
if $ok2patch=0 then
$msg=msgbox(36,$ProcessName, $dlgComment & @crlf & @crlf & "Do you wish to install them now?",60)
if $msg=6 then
$retcode = RunWait($patchpath & $switches)
if $switches = '' then IniWrite ($patchlog,'Installed',$file,'Manual')
; Make logfile-entry according to patch returncode:
case $retcode=0
  IniWrite ($patchlog,'Installed',$file,'Success')
case $retcode=3010
  IniWrite ($patchlog,'Installed',$file,'RebootSuccess')
  if $nonstop=0 then
   $msg=msgbox(36,'Install more Patches?' , 'For best results, no more patches should be installed until after a restart of the computer. However, if you are a laptop-user who rarely has access to updates, you might prefer to install all of the available patches at once. Press Yes to install more patches now. Otherwise press No, or wait a few seconds.',60)
   if $msg = 6 then
    if $interaction > 0 then TrayTip ($Processname,'Pausing here until next reboot',5)
    exitloop; do only one if reboot needed.
case else
  if $logentry = 'Aborted' then
   IniWrite ($patchlog,'Installed',$file,'Failed')
   if $doFailed=0 then IniWrite ($patchlog,'Installed',$file,'Aborted')
  sleep(10000); wait for process to end before repeating

; End main loop.
; Sign-off the log with date of last run, and number of times run:
$RunCount = IniRead ($patchlog,'Log','RunCount',0) +1
IniWrite ($patchlog,'Log','RunCount',$RunCount)
IniWrite ($patchlog,'Log','LastRun',@Year & '/' & @Mon & '/' & @Mday)

Typical sus.ini:

ProcessName=System Patch Installer
Comment=Security patches are available for your computer.



Edited by Anteaus
Link to post
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...