This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Force Update via Script...

Some of our clients have a drive protection software installed so that all changes made are reverted on reboot. Naturally, this conflicts with Sophos updates. So here's how we want to approach this issue:

There is a mechanism that automatically deactivates the drive protection (once a week, for example) and executes a previously configured batch script. (Any user interaction is blocked during that time.) Upon termination of that script, disk protection is re-enabled and everything is going back to normal. So what we're looking for is something that can be called from cmd that forces an update and terminates only after the update has completed.

Now, we already did some experiments with ALUpdate (9.5 and 10.0). Under Windows XP simply calling ALUpdate does nothing while under Windows 7 there was - according to client side logs - a successful update. (In that test scneario however there was nothing to be updated, yet.) The only problem is, that ALUpdate at least seemed to terminate right away. (The update was very quick so it's really hard to tell...) That's a bad thing because there's no way to know when the updated is actually finished. So we're able to call an update (at least under Windows 7), but we don't know when it's done...

Under Windows XP I've also tried the Visual Basic Script to trigger an immediate update. This actually does call the update, but it also terminates right away.

I'm aware that this might be a very race scenario, but it'd be really nice to find a solution to cope with it...

Thomas

:26885


This thread was automatically locked due to age.
Parents
  • HI,

    How about a bit of VBS that kicks off an update, then checks if the alupdate.exe process is running, if not, then it's done.  In this example it kicks off an update, then every 5 seconds checks if the process alupdate.exe is running.  As this runs for the entire update it should do the trick.

    'Call UpdateNow and Monitor For Progress
    
    'Global Objects
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    
    If CheckIfAlupdateRunning() = true then
    	wscript.quit(1)
    End if
    
    CallUpdate()
    wscript.sleep (2000) ' to ensure it starts an update before checking.
    
    
    Do Until CheckIfAlupdateRunning() = false
        wscript.sleep (5000)
    loop
    
    Set objWMIService = nothing
    
    ' Functions-------------------------------------------------------------------
    Function CallUpdate()
      dim objALC : set objALC = CreateObject("ActiveLinkClient.ClientUpdate.1")
      objALC.UpdateNow 1,1
      set objALC = nothing
    End Function 
    
    Function CheckIfAlupdateRunning()
    
    	dim colProcesses : Set colProcesses = objWMIService.ExecQuery _
    		("SELECT * FROM Win32_Process WHERE Name = 'alupdate.exe'")
    
    	If colProcesses.Count = 0 Then
    		CheckIfAlupdateRunning = false
    	Else
    		CheckIfAlupdateRunning = true
    	End If
    
    End Function
    '-------------------------------------------------------------------------------

    Regards,

    Jak

    :26889
Reply
  • HI,

    How about a bit of VBS that kicks off an update, then checks if the alupdate.exe process is running, if not, then it's done.  In this example it kicks off an update, then every 5 seconds checks if the process alupdate.exe is running.  As this runs for the entire update it should do the trick.

    'Call UpdateNow and Monitor For Progress
    
    'Global Objects
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    
    If CheckIfAlupdateRunning() = true then
    	wscript.quit(1)
    End if
    
    CallUpdate()
    wscript.sleep (2000) ' to ensure it starts an update before checking.
    
    
    Do Until CheckIfAlupdateRunning() = false
        wscript.sleep (5000)
    loop
    
    Set objWMIService = nothing
    
    ' Functions-------------------------------------------------------------------
    Function CallUpdate()
      dim objALC : set objALC = CreateObject("ActiveLinkClient.ClientUpdate.1")
      objALC.UpdateNow 1,1
      set objALC = nothing
    End Function 
    
    Function CheckIfAlupdateRunning()
    
    	dim colProcesses : Set colProcesses = objWMIService.ExecQuery _
    		("SELECT * FROM Win32_Process WHERE Name = 'alupdate.exe'")
    
    	If colProcesses.Count = 0 Then
    		CheckIfAlupdateRunning = false
    	Else
    		CheckIfAlupdateRunning = true
    	End If
    
    End Function
    '-------------------------------------------------------------------------------

    Regards,

    Jak

    :26889
Children
No Data