Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CQC Automated Upgrade Using AutoHotKey
#1
[SIZE="2"]CQC Automated Upgrade
Version 1.2[/SIZE]

  • Version 1.1 - Original Version
  • Version 1.2 - CQC 4.4.902+ Support for CQC Client Service

[Image: 3.jpg]

This how to describes how to configure a distributed automatic upgrade on all of your machines using the attached AutoHotKey script/executable and Eventghost. The script will only do an in place upgrade, it does not allow you change the type of install, do a backup, or change any options.

Note: This is a pretty complicated macro, you may want to test it on one of your lesser clients to get a feel for how it works before turning it loose on your system. I highly recommend you make a backup before you run this. I am not responsible if you hose up your CQC install. I highly recommend using [Thread=6643]TM's Backup Script.[/Thread]

The script performs the following steps/functions:
  • Stops the CQC Service (if running)
  • Kills all remaining CQC processes
  • Maps a driver to the path specified (if path starts with "\\...")
  • Launches the CQC Installer
  • Does an unattended upgraded (no backup is done)
  • Closes any browsers
  • Unmaps any drivers
  • Optionally starts the TrayApp and/or Interface Viewer from a shortcut
  • Optionally deletes the CQC shortcuts under the start menu
  • Generates a log file of the install, with success/failure and other info

To run the script, just run the attached executable. The /path= argument specifying the path to the unzipped CQC install directory is required, all other parameters are optional. The executable accepts the following options (also viewable via /? or /help. You will need to have a session logged in to run this script under (since it is basically clicking buttons for you).

Parameters
  • /DelShortcuts Delete CQC Shortcuts when install is finished
  • /Drive=<letter> - Drive letter to map to install dir, (default USmile
  • /IVLink=<path> -Path to shortcut to start IV from (default is link generated by CQC in Start Menu).
  • /Log=<path> - Path to Log File (default is CQCInstall.log under the install path below)
  • /Path=<path> - Path to unzipped CQC install directory
  • /Reboot - Reboot when done
  • /Silent - Don't display progress GUI
  • /StartTray - Start CQC Tray App when done
  • /StartIV - Start CQC Interface Viewer when done
  • /TrayLink=<path> - Path to shortcut to start tray app from (default is link generated by CQC in Start Menu).

Examples:
Quote:CQCInstall.exe /path=\\av-nas\upgrade\CQCPath
  • Will map U:\ to \\av-nas\upgrade\CQCPath
  • Will try to launch U:\CQCInst\CQCInst.exe or if that doesn't exist U:\CQCSetup.cmd
  • No other optional steps will be done
  • Log file will be \\av-nas\upgrade\CQCPath\CQCInstal.log
CQCInstall.exe /path=d:\CQCPath
  • No drives will be mapped
  • Will try to launch d:\CQCPath\CQCInst\CQCInst.exe or d:\CQCPath\CQCSetup.cmd
  • Log file will be d:\CQCPath\CQCInstall.cmd
CQCInstall.exe /path=d:\ /log=cqcmaster.log /starttray /startiv /delshortcuts /silent /ivlink="C:\Users\Wuench\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Charmed Quark Controller\Interface Template Viewer.lnk"
  • No drives will be mapped
  • Will launch installer from d:\CQCInst\CQCInst.exe or d:\CQCSetup.cmd
  • Log file will be d:\cqcmaster.log
  • Will launch Tray App from Start Menu shortcut(before they are deleted)
  • Will launch Interface Viewer from shortcut at C:\Users\Wuench\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Charmed Quark Controller\Interface Template Viewer.lnk
  • Will delete Start Menu shortcuts
  • No progress GUI will be displayed

[Image: btn_donate_LG.gif]

Note: Attached are the source files and compiled version.
You do not need to install AutoHotKey if you use the compiled version.


Attached Files
.zip   CQCUpgrade_Source.zip (Size: 4.92 KB / Downloads: 0)
.zip   CQCUpgrade.zip (Size: 382.59 KB / Downloads: 0)
Wuench
My Home Theater/Automation Website

[THREAD=5957]BlueGlass CQC Config[/THREAD]
[THREAD=10624]Wuench's CQC Drivers[/THREAD]
Reply
#2
I used Eventghost to create a distributed install. The process is kicked off by copying the CQC Zip file to a directory. Eventghost then unzips it and kicks off the install on my machines.

Here is the process I follow:
  • Eventghost watches a directory for the Created event using the DirectoryWatcher plugin
  • The install directory is deleted if it exists
  • The zip file is unzipped to the install directory
  • Wake-On-Lan signals are sent
  • The TM CQC Backup Script is launched to backup the master server
  • The CQCUpgrade script is launched to upgrade the master server
  • When finished, a broadcast of CQCInstallFin-CQCServer is sent using the broadcaster plugin
  • All the other CQC clients hear the CQCInstallFin-CQCServer broadcast and each kick off the CQCUpgrade script (4 machines simultaneously)

EventGhost Configuration Files

CQC Master Server - Needs Broadcaster Plugin on port 22222
Code:
<Macro Name="Start Program: CQCInstall.exe" Expanded="True">
        <Event Name="Broadcast.CQCInstall-CQCServer" />
        <Action Name="Backup CQC">
            System.Execute(u'C:\\Program Files\\Scripts\\CQCBackup.CMD', u'', 0, True, 2, u'C:\\Program Files\\Scripts', True)
        </Action>
        <Action>
            System.Execute(u'\\\\THEATERPC\\Archive\\Projects\\CQC Projects\\CQCUpgrade\\CQCUpgrade.exe', u'/path=\\\\av-nas\\backup\\CQCInstall /delshortcuts /starttray /log=\\\\av-nas\\backup\\CQCInstall\\CQCServer.log', 0, True, 2, u'', True)
        </Action>
        <Action>
            BroadcastListener.Broadcast(u'CQCInstallFin-CQCServer', u'CQCServer', 22222)
        </Action>
    </Macro>

Client Machines - Needs Broadcaster Plugin on Port 22222
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
    <Macro Name="Upgrade CQC" Expanded="True">
        <Event Name="Broadcast.CQCInstallFin-CQCServer" />
        <Action>
            System.Execute(u'\\\\THEATERPC\\Archive\\Projects\\CQC Projects\\CQCUpgrade\\CQCUpgrade.exe', u'/path=\\\\av-nas\\backup\\cqcinstall /delshortcuts /log=\\\\av-nas\\backup\\CQCInstall\\Studio.log', 0, True, 2, u'', True)
        </Action>
    </Macro>
</EventGhost>

Controller Machine - Needs Broadcaster Plugin on Port 22222 and DirectoryWatcher plugin
This is the code to put on one of the machines to watch the directory, do the unzipping, and other file maintenance. Then start the whole process by sending out the CQCInstall-CQCServer message. You will need 7Zip on this machine to unzip the files.

Code:
<Macro Name="New CQC File - Trigger Install" Expanded="True">
        <Event Name="DirectoryWatcher3.Created" />
        <Action>
            EventGhost.Wait(5.0)
        </Action>
        <Action Name="Delete Install Dir">
            System.Execute(u'C:\\Windows\\System32\\cmd.exe', u'/C rmdir /S /Q \\\\av-nas\\backup\\CQCInstall', 3, True, 2, u'', True)
        </Action>
        <Action>
            EventGhost.Wait(5.0)
        </Action>
        <Action Name="Unzip Install Files">
            System.Execute(u'C:\\Program Files\\7-Zip\\7z.exe', u'x "F:\\Archive\\Applications\\Home Automation\\CQC\\ToInstall\\*.zip" -o\\\\av-nas\\backup\\CQCInstall -aoa', 3, True, 2, u'', True)
        </Action>
        <Action>
            EventGhost.Wait(5.0)
        </Action>
        <Action Name="Delete CQC Zip File">
            System.Execute(u'C:\\Windows\\System32\\cmd.exe', u'/C erase "F:\\Archive\\Applications\\Home Automation\\CQC\\ToInstall\\*.*" /F /Q', 3, True, 2, u'', True)
        </Action>
        <Action Name="Wake Avalon">
            System.WakeOnLan(u'00-22-15-68-37-9B')
        </Action>
        <Action>
            BroadcastListener.Broadcast(u'CQCInstall-CQCServer', u'', 22222)
        </Action>
    </Macro>
Wuench
My Home Theater/Automation Website

[THREAD=5957]BlueGlass CQC Config[/THREAD]
[THREAD=10624]Wuench's CQC Drivers[/THREAD]
Reply
#3
If you want to duplicate what I did and display status messages in the upper right corner of your client(s) you need the code below. To send a message you just need to send a broadcaster event of name OSD with your message in the payload. Just paste these into Eventghost...

Send an OSD Message - Upgrading CQC (Studio)
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
    <Action>
        BroadcastListener.Broadcast(u'OSD', u'Upgrading CQC (Studio)', 22222)
    </Action>
</EventGhost>

Code to Display OSD Messages on a Client
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
    <Macro Name="Show OSD:  {eg.event.*}" Expanded="True">
        <Event Name="Broadcast.OSD" />
        <Action>
            EventGhost.ShowOSD(u' {eg.event.payload}', u'0;-24;0;0;0;700;0;0;0;0;3;2;1;34;Century Gothic', (255, 255, 255), (107, 119, 148), 1, (0, 0), 0, 10.0, True)
        </Action>
    </Macro>
</EventGhost>
Wuench
My Home Theater/Automation Website

[THREAD=5957]BlueGlass CQC Config[/THREAD]
[THREAD=10624]Wuench's CQC Drivers[/THREAD]
Reply
#4
Holly actual F__K! You really wanted that silent installer! Why do you give me more work?? Now I have to review all this interesting stuff!
--Kill all the serial ports--
Reply
#5
Yeah, it was a few days work. I finally got around all the issues so it will run without having an open RDP session (but you do still have to have a user logged in on the machine for all this to run under). I have used it for the last two upgrades and it has worked for me with no issues.
Wuench
My Home Theater/Automation Website

[THREAD=5957]BlueGlass CQC Config[/THREAD]
[THREAD=10624]Wuench's CQC Drivers[/THREAD]
Reply
#6
Posted an updated version for CQC 4.4.902+ that supports killing and reporting the status of the CQC Client Service in the logs.
Wuench
My Home Theater/Automation Website

[THREAD=5957]BlueGlass CQC Config[/THREAD]
[THREAD=10624]Wuench's CQC Drivers[/THREAD]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)