Whipper Posted April 23, 2008 Posted April 23, 2008 Hi everybody, I need to update virus pattern for 300 user's . (no connection on trend micro server) The script will be launched at the connection on the user's to a server on a domain. I have a shared folder on the server named "Script" and inside a subfolder "Backup" The server download on Trend Micro web site with a another script the virus pattern (=> it works fine) Before download the virus pattern (2 times each day) a copy of the last pattern will be saved inside the backup folder. So when the user login to the server the script do this check 3 files: 1 - Virus pattern on his computer 2 - Virus pattern on the Script folder 3 - Virus pattern on the backup folder (to check the name and to verify the size of the file pattern) If Virus pattern on the user computer are smaller => copy the new pattern from the Script folder, end of script If Virus pattern on the user computer are egal => nothing only a message "Pattern already Updated" end of script If Virus pattern on the script folder not exist => copy the backup pattern from the backup folder, end of script I have some problems with my script _ I try with a older pattern on a user to force to copy the new but the script say "File already Updated." (do nothing on the copy) _ If the copy works (quote the two endif) the name of the pattern will not change with the new name (he keep the old name) _ I don't now ,how to do with the copy of the backup pattern.... (with the if,else and endif) _ I think my script will not take the size of my files with the filegetsize function Best Regards expandcollapse popupOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) ;Declare Variables $client= @ProgramFilesDir & "\Trend Micro\OfficeScan Client\" #$server= "\\*******\sysvol\SW3.Local\scripts\" #$backup= "\\*******\sysvol\SW3.Local\scripts\backup\" #$filexe= $client & 'INSTREG.EXE' ; Search the filenames of all files. $search = FileFindFirstFile ($client & "lpt$vpn.*") $search2 = FileFindFirstFile ($server & "lpt$vpn.*") $search3 = FileFindFirstFile ($backup & "lpt$vpn.*") ; Check if the search was successful If $search = -1 Then MsgBox(16, "Error", "No file pattern found Please contact Administrator") Exit EndIf If $search2 = -1 Then MsgBox(48, "Error", "No file pattern found on the server", "1") EndIf If $search3 = -1 Then MsgBox(16, "Error", "No Backup file pattern found on the server") Exit EndIf $file = FileFindNextFile($search) MsgBox(4096, "User:", $file, "1") $file2 = FileFindNextFile($search2) MsgBox(4096, "Server:", $file2, "1") $file3 = FileFindNextFile($search3) MsgBox(4096, "Backup:", $file3, "1") ; Close the search handle FileClose($search) FileClose($search2) FileClose($search3) $size = FileGetSize($file) $size2 = FileGetSize($file2) $size3 = FileGetSize($file3) If $size < $size2 Then MsgBox(64,"", "UpdateS in progress." ,"1") FileDelete ($client & "lpt$vpn.*") FileCopy ($server & $file2, $client) EndIf If $size = $size2 Then MsgBox(48,"", "File already Updated." ,"1") EndIf If not FileExists ($server & $file2) Then MsgBox(48,"", "UpdateB in progress." ,"1") FileDelete ($client & "lpt$vpn.*") FileCopy ($backup & $file3, $client) EndIf ; Launch Update Runwait ($filexe) Exit
Zedna Posted April 24, 2008 Posted April 24, 2008 expandcollapse popupOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) ;Declare Variables $client= @ProgramFilesDir & "\Trend Micro\OfficeScan Client\" $server= "\\*******\sysvol\SW3.Local\scripts\" $backup= "\\*******\sysvol\SW3.Local\scripts\backup\" $filexe= $client & 'INSTREG.EXE' ; Search the filenames of all files. $search = FileFindFirstFile ($client & "lpt$vpn.*") $search2 = FileFindFirstFile ($server & "lpt$vpn.*") $search3 = FileFindFirstFile ($backup & "lpt$vpn.*") ; Check if the search was successful If $search = -1 Then MsgBox(16, "Error", "No file pattern found Please contact Administrator") Exit EndIf If $search2 = -1 Then MsgBox(48, "Error", "No file pattern found on the server", "1") Exit EndIf If $search3 = -1 Then MsgBox(16, "Error", "No Backup file pattern found on the server") Exit EndIf $file = FileFindNextFile($search) MsgBox(4096, "User:", $file, "1") $file2 = FileFindNextFile($search2) MsgBox(4096, "Server:", $file2, "1") $file3 = FileFindNextFile($search3) MsgBox(4096, "Backup:", $file3, "1") ; Close the search handle FileClose($search) FileClose($search2) FileClose($search3) $size = FileGetSize($client & $file) $size2 = FileGetSize($server & $file2) $size3 = FileGetSize($backup & $file3) If $size < $size2 Then MsgBox(64,"", "UpdateS in progress." ,"1") FileDelete ($client & "lpt$vpn.*") FileCopy ($server & $file2, $client) ElseIf $size = $size2 Then MsgBox(48,"", "File already Updated." ,"1") ElseIf not FileExists ($server & $file2) Then MsgBox(48,"", "UpdateB in progress." ,"1") FileDelete ($client & "lpt$vpn.*") FileCopy ($backup & $file3, $client) EndIf ; Launch Update Runwait ($filexe) Exit Resources UDF ResourcesEx UDF AutoIt Forum Search
Whipper Posted April 24, 2008 Author Posted April 24, 2008 expandcollapse popupOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) ;Declare Variables $client= @ProgramFilesDir & "\Trend Micro\OfficeScan Client\" $server= "\\*******\sysvol\SW3.Local\scripts\" $backup= "\\*******\sysvol\SW3.Local\scripts\backup\" $filexe= $client & 'INSTREG.EXE' ; Search the filenames of all files. $search = FileFindFirstFile ($client & "lpt$vpn.*") $search2 = FileFindFirstFile ($server & "lpt$vpn.*") $search3 = FileFindFirstFile ($backup & "lpt$vpn.*") ; Check if the search was successful If $search = -1 Then MsgBox(16, "Error", "No file pattern found Please contact Administrator") Exit EndIf If $search2 = -1 Then MsgBox(48, "Error", "No file pattern found on the server", "1") Exit EndIf If $search3 = -1 Then MsgBox(16, "Error", "No Backup file pattern found on the server") Exit EndIf $file = FileFindNextFile($search) MsgBox(4096, "User:", $file, "1") $file2 = FileFindNextFile($search2) MsgBox(4096, "Server:", $file2, "1") $file3 = FileFindNextFile($search3) MsgBox(4096, "Backup:", $file3, "1") ; Close the search handle FileClose($search) FileClose($search2) FileClose($search3) $size = FileGetSize($client & $file) $size2 = FileGetSize($server & $file2) $size3 = FileGetSize($backup & $file3) If $size < $size2 Then MsgBox(64,"", "UpdateS in progress." ,"1") FileDelete ($client & "lpt$vpn.*") FileCopy ($server & $file2, $client) ElseIf $size = $size2 Then MsgBox(48,"", "File already Updated." ,"1") ElseIf not FileExists ($server & $file2) Then MsgBox(48,"", "UpdateB in progress." ,"1") FileDelete ($client & "lpt$vpn.*") FileCopy ($backup & $file3, $client) EndIf ; Launch Update Runwait ($filexe) Exit Thank's guy you save me !!!
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