Octoscan2 - Updating Octoscan2 Without Manually Closing Files

  • OK, you have successfully installed Octoscan2 to a central network share and are running it via GPO in your environment.
    But what if you want to update the scanner software to take advantage of the newest features? Windows does not let you overwrite an .exe file as long as a copy is running somewhere. Also, starting with Windows Server 2003, you can no longer rename an .EXE file while the program is running.

    A clean way is of course to change the GPO to point to new location, but that is sometimes not desirable because you may have many GPO and/or you may not have the permissions to change the GPO.

    Alternative 1: Close open file handles

    A straightforward method is to close open files on the share, and then just replace the .exe. For this, you need to have Administrator rights on the server.
    To my experience, scanners already started will continue to run. If some fail, there is not much damage, since the .scan file gets written right at the start of the scan. Worst case you lose some metering data. Anyway, it's a good idea to do this during off-peak hours.

    Since OctoSAM 1.9.3, there is a script to close open handles to Octoscan2.exe only. The script must be run as Administrator.

    Code
    close_octoscan2_handles.cmd

    Alternative 2: Use emacs style update

    The second method is a bit more elaborate. It is inspired by the way the legendary Unix editor emacs does it. This method relies on support built-in to the Octoscan2.exe program. Here's how it works:

    • Copy the new Octoscan2.exe to the central share but name it Octoscan2-1.exe.
    • The GPO will still start Octoscan2.exe but at the start, Octoscan2.exe will detect that there is a newer Octoscan2-1.exe and will replace itself with the newer executable.
    • After a couple of days, there will be no long-running processes started from Octoscan2.exe, which allows you to replace the original Octoscan2.exe.
    • Now, on start Octoscan2.exe will detect, that Octoscan2-1.exe is older or the same date and will just keep on running. After another few days, you will have no running instances of Octoscan2-1.exe on your network and you can safely delete the file.

    Octoscan2 allows up to 3 updates (Octoscan2-1.exe, Octoscan2-2.exe and Octoscan2-3.exe) to be placed in the same share, but it's a good Idea to clean up after update-1 or update-2.

    NB: This method does not work when you start the scanner with psexec on a remote machine. In this case, configure a separate folder with Octoscan2.exe and octoscan.config for psexec invocation.