Jump to content

windows update


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:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

mrjoli021,

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

M23

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:

Spoiler

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 comment
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 comment
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.

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=sus.ico
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseAnsi=n
#AutoIt3Wrapper_Res_Description=LAN Software Updater
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#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'
$OSPatchFolder=iniread($IniFile,"OSPatch",@osversion,@osversion)
$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.
$PatchLogDir=IniRead($iniFile,"General","PatchLogDir",@WindowsDir)
$patchlog= $PatchLogDir & '\' & @computername &  '_Patchlog.txt'
; Check for commandline switches:
; doFailed=Repeat the failures (and do new)
; doAll=Repeat whole sequence, missing none.
$inhibit="KB890830,KB892130,KB905474"
$doFailed=IniRead($iniFile,"General","DoFailed",0)
$doAll=IniRead($iniFile,"General","DoAll",0)
$interaction=IniRead($iniFile,"General","Interaction",1)
$Processname=IniRead($iniFile,"General","ProcessName","IWRConsultancy System Patch Installer")
$dlgComment=IniRead($iniFile,"General","Comment","Security patches are available for your computer.")
$inhibit=IniRead($iniFile,"General","Inhibit",$inhibit)
$inhibit = stringsplit($inhibit,",|;: ")
select
case $interaction=0
; As near to silent operation as possible.
$ok2patch=1
$nonstop=1
$silent=1
case $interaction=1
; Ask user at startup only, try to remain 'silent' thereafter.
$ok2patch=0
$nonstop=1
$silent=1
case else
; Ask at start/when reboot needed, give feedback via tray icon.
$ok2patch=0
$nonstop=0
$silent=0
endselect
if $cmdLine[0]>0 then
if StringInStr($cmdLine[1],"/f") then
   $doFailed=1
  endif
if StringInStr($cmdLine[1],"/a") then
   $doAll=1
  endif
endif
; Enumerate patch folder:
$_pathtoscan = $PatchFolder & '\*.exe'
$_spSearch = FileFindFirstFile ( $_pathtoscan )
If $_spSearch = -1 Then
   ;  MsgTip(0, "PatchError", "No patches found for this OS")
   exit
EndIf
; 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.
endif
endif
for $ict = 1 to $inhibit[0]
if stringinstr($file,$inhibit[$ict]) > 0  then
  IniWrite ($patchlog,'Installed',$file,'Inhibited')
  continueloop 2
endif
next
$PatchPath = $PatchFolder & '\' & $file
; Make a shortname for the Tray Tip:
$shortname=$file
$kbpos=stringinstr($shortname,'-kb')+1
if $kbpos > 0 then
$chars=stringinstr($shortname,'-x86')-$kbpos
if $chars < 1 then $chars = stringlen($shortname)
$shortname= stringmid($shortname,$kbpos,$chars)
endif
; 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.

select
case $silent=0
  $switches= ''
case stringleft($file,7)='windows'
  $switches= ' /Q /Z /M'
case stringleft($file,6)='office'
  $switches= ' /Q'
case else
  $switches= ''
endselect
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
  $ok2patch=1
else
  exitloop
endif
endif
sleep(3000)
$retcode = RunWait($patchpath & $switches)
if $switches = '' then IniWrite ($patchlog,'Installed',$file,'Manual')
; Make logfile-entry according to patch returncode:
select
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
    $nonstop=1
   else
    if $interaction > 0 then TrayTip ($Processname,'Pausing here until next reboot',5)
    sleep(2000)
    exitloop; do only one if reboot needed.
   endif
  endif
case else
  if $logentry = 'Aborted' then
   IniWrite ($patchlog,'Installed',$file,'Failed')
  else
   if $doFailed=0 then IniWrite ($patchlog,'Installed',$file,'Aborted')
  endif
  sleep(10000); wait for process to end before repeating
endselect

Wend
; End main loop.
FileClose($_spSearch)
; 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)
exit

Typical sus.ini:

[General]
ProcessName=System Patch Installer
Interaction=1
Comment=Security patches are available for your computer.
DoFailed=0
DoAll=0

[OSPatch]
WIN_2000=Windows2000
WIN_2003=WindowsServer2003
WIN_XP=WindowsXP
WIN_VISTA=WindowsVista
WIN_7=Windows7

[Categories]

[GetUpdates]
MinSeverity=0
mbsa=1
test=0
inhibit=KB936929,KB890830,KB892130,KB905474,KB923789,KB971961,KB914961
include=KB958752
Edited by Anteaus
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
 Share

  • Recently Browsing   0 members

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