Stuperman Posted January 25, 2008 Share Posted January 25, 2008 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. Link to comment Share on other sites More sharing options...
Greenhorn Posted January 25, 2008 Share Posted January 25, 2008 Moin, I made the following Script for an Hotfix integration into a XP Setup CD, but you can customize it for your needs ... expandcollapse popup#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 Link to comment Share on other sites More sharing options...
Stuperman Posted January 25, 2008 Author Share Posted January 25, 2008 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. Link to comment Share on other sites More sharing options...
Greenhorn Posted January 25, 2008 Share Posted January 25, 2008 (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.htmlSearch for the switches /Q /O /N /Z and /Q:A /R:N and look at the pics, then you know what I mean ...GreetzEdit: Here the english version, maybe it's easier for you ...http://unattended.msfn.org/unattended.xp/view/web/24/ Edited January 25, 2008 by Greenhorn Link to comment Share on other sites More sharing options...
Greenhorn Posted January 25, 2008 Share Posted January 25, 2008 For downloading the Updates take a look at this little nice Tool ...http://www.heise.de/ct/projekte/offlineupd...ctupdate471.zipEnglish Forum:http://www.heise-security.co.uk/forums/S-O...um-108277/list/Greetz Link to comment Share on other sites More sharing options...
weaponx Posted January 25, 2008 Share Posted January 25, 2008 (edited) Lifehacker had something posted about this recently...http://lifehacker.com/347505/update-window...-offline+update Edited January 25, 2008 by weaponx Link to comment Share on other sites More sharing options...
Stuperman Posted February 1, 2008 Author Share Posted February 1, 2008 Thanks for all of the help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now