Hallo an alle!
hier ein Script zum Verteilen von Firefox Updates im Unternehmens Netzwerk!
Viel Spass damit !
1. AutoIT installiern1
2. Aus Script -> EXE machen ! -> Wichtig vorher Script an Verzeichnisse und Version anpassen!
3. Verzeichnis auf Server freigeben und marfile von FTP Server laden !
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
4. Erstellte exe bei Usern ausführen lassen per Task oder mit AD Anmeldung!
Bei fragen einfach melden!
Marcel Joist
C
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
Global $ver, $checkver
$UserProfilPath = EnvGet("USERPROFILE")
$checkver = '3.5.3'
$ver = FileGetVersion("C:\Programme\Mozilla Firefox\firefox.exe", "ProductVersion")
$Username = EnvGet("USERNAME")
$Computername = EnvGet("COMPUTERNAME")
$LogCSV = "\\svfs1\Update$\Firefox\updatelog.csv"
$FirefoxUpdatePath = $UserProfilPath & "\Lokale Einstellungen\Anwendungsdaten\Mozilla\Firefox\Mozilla Firefox\updates\0\"
$firefoxexe = "C:\Programme\Mozilla Firefox\firefox.exe"
$Message = "Bitte schließen Sie den Firefox!"
$marfile = "\\svfs1\Update$\Firefox\update.mar"
if FileExists($firefoxexe) Then
If $ver<>$checkver Then
$UpdateOK = 0
While $UpdateOK == 0
$plist = ProcessList("firefox.exe")
if $plist[0][0] == 0 Then
$line = FileReadLine($LogCSV)
$writeheader = StringInStr($line, "USERNAME")
if $writeheader == 0 Then
FileWriteline($LogCSV, "COMPUTERNAME;USERNAME;OLDVERSION;START;REMOVE DIR;CREATE DIR;COPY MAR FILE;WRITE UPDATE.STATUS;WRITE UPDATE.VERSION;END;")
EndIf
FileWrite($LogCSV, $Computername &";")
FileWrite($LogCSV, $Username &";")
FileWrite($LogCSV, "V"&$ver &";")
FileWrite($LogCSV, "OK;")
UpdateFirefox()
FileWriteline($LogCSV, "OK;")
ShellExecute($firefoxexe)
$UpdateOK = 1
Else
MsgBox(4096, "Update Firefox", $Message)
EndIf
WEnd
else
$line = FileReadLine($LogCSV)
$writeheader = StringInStr($line, "USERNAME")
if $writeheader == 0 Then
FileWriteline($LogCSV, "COMPUTERNAME;USERNAME;OLDVERSION;START;REMOVE DIR;CREATE DIR;COPY MAR FILE;WRITE UPDATE.STATUS;WRITE UPDATE.VERSION;END;")
EndIf
FileWrite($LogCSV, $Computername &";")
FileWrite($LogCSV, $Username &";")
FileWriteline($LogCSV, "Version already Installed;Version already Installed;Version already Installed Version already Installed;Version already Installed Version already Installed;Version already Installed;Version already Installed Version already Installed;Version already Installed;Version already Installed;")
EndIf
else
$line = FileReadLine($LogCSV)
$writeheader = StringInStr($line, "USERNAME")
if $writeheader == 0 Then
FileWriteline($LogCSV, "COMPUTERNAME;USERNAME;OLDVERSION;START;REMOVE DIR;CREATE DIR;COPY MAR FILE;WRITE UPDATE.STATUS;WRITE UPDATE.VERSION;END;")
EndIf
FileWrite($LogCSV, $Computername &";")
FileWrite($LogCSV, $Username &";")
FileWrite($LogCSV, "V"&$ver &";")
FileWriteline($LogCSV, "NOTINSTALL;NOTINSTALL;NOTINSTALL NOTINSTALL;NOTINSTALL NOTINSTALL;NOTINSTALL MAR FILE;NOTINSTALL NOTINSTALL;NOTINSTALL;NOTINSTALL;")
EndIf
Func UpdateFirefox()
Local $progressbar1, $progressbar2, $button, $wait, $s, $msg, $m
GUICreate("FirefoxUpdate", 220, 100, 100, 200)
$progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
GUICtrlSetColor(-1, 32250); not working with Windows XP Style
GUISetState()
GUICtrlSetData($progressbar1, 10)
$status = DirRemove($FirefoxUpdatePath,1)
if $status = 1 then
FileWrite($LogCSV, "OK;")
else
FileWrite($LogCSV, "FALSE;")
EndIf
$status = DirCreate($FirefoxUpdatePath)
if $status = 1 then
FileWrite($LogCSV, "OK;")
else
FileWrite($LogCSV, "FALSE;")
EndIf
$status = FileCopy($marfile, $FirefoxUpdatePath)
if $status = 1 then
FileWrite($LogCSV, "OK;")
else
FileWrite($LogCSV, "FALSE;")
EndIf
GUICtrlSetData($progressbar1, 90)
$FirefoxUpdateStatusFile = $FirefoxUpdatePath & "update.status"
$FirefoxUpdateVersionFile = $FirefoxUpdatePath & "update.version"
$status = FileWrite($FirefoxUpdateStatusFile, "pending")
if $status = 1 then
FileWrite($LogCSV, "OK;")
else
FileWrite($LogCSV, "FALSE;")
EndIf
$status = FileWrite($FirefoxUpdateVersionFile, $checkver)
if $status = 1 then
FileWrite($LogCSV, "OK;")
else
FileWrite($LogCSV, "FALSE;")
EndIf
EndFunc ;==>Example
Alles anzeigen