Sign in to follow this  
Followers 0
Stuperman

Windows Updates

7 posts in this topic

I want to install Windows Updates from a CD. I would download all of them and then make a script mainly using _RunDos and then using the switches for each update. Is there a way I could make the script automatically scan a folder and use the _RunDos command for every file in said folder? Or do I have to make a command for each and every update in that folder, referencing the filename? I haven't started yet. Just curious. Thank you all.

Share this post


Link to post
Share on other sites



Moin,

I made the following Script for an Hotfix integration into a XP Setup CD, but you can customize it for your needs ...

#Include <File.au3>
#include <GuiConstants.au3>

Opt('RunErrorsFatal', 0)
Opt('WinTextMatchMode', 1)

Global $szFailed, $szLog, $iLog

$hGUI = GuiCreate("Hotfix Integrator", 635, 480,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), $WS_EX_ACCEPTFILES)

$Group = GuiCtrlCreateGroup("", 20, 30, 585, 120)

$Label_3 = GuiCtrlCreateLabel("Quelle:", 30, 40, 310, 20)
$inputSourcepath = GuiCtrlCreateInput("Quellordner", 30, 60, 350, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Label_4 = GuiCtrlCreateLabel("Ziel XPCD:", 30, 90, 280, 20)
$inputCDrootpath = GuiCtrlCreateInput("Zielordner", 30, 110, 350, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$btnSourcepath = GuiCtrlCreateButton("Durchsuchen...", 400, 58, 100, 25)
$btnCDrootpath = GuiCtrlCreateButton("Durchsuchen...", 400, 108, 100, 25)

$ListBox = GuiCtrlCreateList("", 30, 180, 350, 280)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$btnStart = GuiCtrlCreateButton("Start", 505, 430, 80, 25)



GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $btnSourcepath
        Global $szFileversion
        Global $szHotfixpath = FileSelectFolder('Bitte Quellordner auswählen...', '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}', 2)
        Global $arHotfixes = _FileListToArray($szHotfixpath, '*.*', 1)
        GUICtrlSetData($inputSourcepath, $szHotfixpath)
        For $i = 1 To $arHotfixes[0]
            $szFileversion = FileGetVersion($szHotfixpath & '\' & $arHotfixes[$i])
            Switch $szFileversion
                Case '1.0.0.0' To '99.0.0.0'
                    GUICtrlSetData($ListBox, $arHotfixes[$i])
                Case '3.1.0.0'
                    GUICtrlSetData($ListBox, $arHotfixes[$i])
                Case '6.2.29.0'
                    GUICtrlSetData($ListBox, $arHotfixes[$i])
                Case Else
                    MsgBox(64, '', 'Version : ' & $szFileversion)
            EndSwitch            
        Next
    Case $msg = $btnCDrootpath
        Global $szCDpath = FileSelectFolder('Bitte Zielordner auswählen...', '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}', 2)
        GUICtrlSetData($inputCDrootpath, $szCDpath)
    Case $msg = $btnStart
        If Not StringInStr(GUICtrlRead($inputSourcepath), '\') Then
            MsgBox(48, 'Error', 'Bitte Quellordner wählen!')
        ElseIf Not StringInStr(GUICtrlRead($inputCDrootpath), '\') Then
            MsgBox(48, 'Error', 'Bitte Zielordner wählen!')
        Else
            _integrate()
        EndIf
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Func _integrate()
    
    GUICtrlSetState($btnStart, $GUI_DISABLE)
    
    $hGUIProgress = GUICreate("Hotfix Integration", 390, 140, -1, 100, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS),'', $hGUI)
    
    Local $Label_1 = GUICtrlCreateLabel("Bitte warten...", 20, 40, 350, 20)
    Local $hProgress = GUICtrlCreateProgress(20, 60, 350, 20)
    Local $Label_2 = GUICtrlCreateLabel("", 20, 100, 350, 20)
    Local $iPercent = (100 / ($arHotfixes[0] - 1))
    
    
    GuiSetState()
    For $i = 1 To $arHotfixes[0]
        GUICtrlSetData($hProgress, ($i * $iPercent))
        GUICtrlSetData($Label_2, $arHotfixes[$i] &  " wird integriert ...")
        Run($szHotfixpath & "\" & $arHotfixes[$i] & " /quiet /integrate:" & $szCDpath & '  /log:'&  $szCDpath, '', @SW_HIDE)
        If @error = 1 Then
            MsgBox(48, 'Error - Hotfix Integration', $arHotfixes[$i] & ': Integration fehlgeschlagen!', 5)
        Else
            $szLog &= '    ' & $arHotfixes[$i] & @CRLF
            $iLog += 1
        EndIf
        While ProcessExists('update.exe')
            If WinExists('', 'update.exe hat ein Problem festgestellt') Then
                ControlClick('', 'update.exe hat ein Problem festgestellt', 'Button1')
            EndIf            
        WEnd
        
        ProcessWaitClose('update.exe')
        Sleep(3000)
    Next
    
    GUIDelete($hGUIProgress)
    
    If $szFailed = '' Then
        $fhLog = FileOpen($szCDpath & '\Hotfixes.log', 2)
        FileWriteLine($fhLog, '          ########################################')
        FileWriteLine($fhLog, '          ###       Hotfix-Integration       #####')
        FileWriteLine($fhLog, '          ########################################')
        FileWriteLine($fhLog, '               Date: ' & @MDAY & '.' & @MON & '.' & @YEAR & ',    Time: ' & @HOUR & ':' & @MIN)
        FileWriteLine($fhLog, '')
        FileWriteLine($fhLog, '')
        FileWriteLine($fhLog, ' Folgende ' & $iLog & ' Hotfixes sind integriert worden:')
        FileWriteLine($fhLog, '')
        FileWrite($fhLog, $szLog)
        FileWriteLine($fhLog, '')
        FileWriteLine($fhLog, '; Log Ende')
        MsgBox(64, 'Hotfix Integration', 'Es wurden alle Hotfixes integriert !')
    Else
        MsgBox(64, 'Hotfix Integration', 'Folgende Hotfixes konnten nicht integriert werden:' & @CRLF & @CRLF & $szFailed)
        $fhErrorlog = FileOpen($szCDpath & '\Not_integrated.log', 2)
        FileWrite($fhErrorlog, $szFailed)
        FileClose($fhErrorlog)
        ShellExecute($szCDpath & '\Not_integrated.log')
    EndIf

    GUICtrlSetState($btnStart, $GUI_ENABLE)

EndFunc

Greetz

Greenhorn

Share this post


Link to post
Share on other sites

Cool, will have to try that out later. Does it only install the updates that you need? And does it show which updates are being installed. Thank you again.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Oh no, it integrates the Hotfixes from a selected folder into a XP Setup CD !

For your needs you just need a little code snippet, but if you take a deeper look into the Script you will see what I mean.

For installing the Hotfixes you have to modify the switches. Take care for the right silent switches for the file versions of each Hotfix ...

My english is too bad for explaining. Please take a look at the following Link, if you have trouble, contact me ...

http://www.windows-unattended.de/unattende...vcpack.inf.html

Search for the switches /Q /O /N /Z and /Q:A /R:N and look at the pics, then you know what I mean ...

Greetz

Edit: Here the english version, maybe it's easier for you ...

http://unattended.msfn.org/unattended.xp/view/web/24/

Edited by Greenhorn

Share this post


Link to post
Share on other sites

Thanks for all of the help

Share this post


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
Sign in to follow this  
Followers 0