Jump to content

Autoit KB installer


Recommended Posts

This was written so the security guy could give me a zip file full of all the new approved KBs for XP and svr 2003 and all I have to do is compile this. If you can use it, do so, and I would welcome any suggestions at all.

in its current state, relative to the au3 you need:

folder named XP - containing KBs.zip

folder named SVR - containing KBs.zip

updating.bmp

#AutoIt3Wrapper_Icon=iava.ico
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
#Include <StaticConstants.au3>
#Include <AviConstants.au3>
#include <Array.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

DirRemove ("c:\temp1\" , 1)
DirRemove ("c:\temp2\" , 1)
sleep (1000)
Dircreate ("c:\temp1")
Dircreate ("c:\temp2")
FileInstall ("updating.bmp" , "c:\temp1\" , 1)
SplashImageOn ("","c:\temp1\updating.bmp",@DesktopWidth, @DesktopHeight,"","",1)
tooltip ("Unpacking and Preparing the System for Update" , "" , "" , "KBrunner" , 1 , 4)

If @OSVersion="WIN_XP" then
FileInstall (".\XP\KBs.zip" , "c:\temp1\" , 1)
ElseIf @OSVersion="WIN_2003" then
FileInstall (".\SVR\KBs.zip" , "c:\temp1\" , 1)
Else
msgbox (0, "Invalid OS", "This operating system is not supported" , 10)
EndIf

$log = FileOpen("C:\temp1\log.txt" , 1)
$zip = FileGetShortName (@ProgramFilesDir & '\Winzip\Winzip32.exe')
Runwait("cmd" & " /c " & $zip &" -min " &"-e " & "C:\temp1\KBs.zip "& "c:\temp2\")
$Array = RecursiveFileSearch ("c:\temp2\")
sleep (2000)
AdlibRegister ("_adlib_check", 1000)
_KBarray()
ProgressOff ()
sleep (2000)
DirRemove ("c:\temp2\" , 1)
FileDelete ("c:\temp1\KBs.zip")
splashoff()
sleep (500)
FileDelete ("c:\temp1\updating.bmp")
run ("notepad.exe " & "c:\temp1\log.txt")
exit

;;;;;;;;;;;;;RUNNING THE ARRAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNC _KBarray()

$size = UBound ($Array) - 1
for $i = 1 to $size step +1
tooltip ("Installing " & $Array[$i] , "" , "" , "KBrunner" , 1 , 4)
$err=runwait ($Array[$i] & " -z"&" -m")
if $err = 0 Then
FileWrite ($log, $Array[$i] &" Installed Successfully "& @CRLF)
Else
FileWrite ($log, $Array[$i] &" exited with an error code of "& $err & @CRLF)
EndIf
next
EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;==>RUNNING THE ARRAY



;;;:::::WEAPON X's - RECURSIVE FILE SEARCH:::::::::::::::::::::::::::
Func RecursiveFileSearch ($startDir, $depth = 0)

If $depth = 0 Then Global $RFSstring = ""

$search = FileFindFirstFile($startDir & "\*.*")
If @error Then Return

;Search through all files and folders in directory
While 1
$next = FileFindNextFile($search)
If @error Then ExitLoop

;If folder, recurse
If StringInStr(FileGetAttrib($startDir & "\" & $next), "D") Then
RecursiveFileSearch ($startDir & "\" & $next, $depth + 1)
Else
;Append filename to master string
$RFSstring &= $startDir & "\" & $next & "*"
EndIf
WEnd
FileClose($search)

If $depth = 0 Then Return StringSplit(StringTrimRight($RFSstring, 1), "*")

EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;==>RecursiveFileSearch


;;;;;;;;;;;;Function to handle the "Microsoft Certificate Services" error:::::::::::::::::::::::
func _adlib_check()
local $wintitle = "Microsoft Certificate Services"
; activate the window if it exists
if winexists ($wintitle) and not winactive ($wintitle) then
winactivate ($wintitle)
sleep (500)
endif
; send enter if the window is active
if winactive ($wintitle) then
send ("{enter}")
sleep (1000)
endif
endfunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;==>RFunction for the "Microsoft Certificate Services" error

Edited by iamtheky
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
  • Recently Browsing   0 members

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