<job id="DetectUpgradeCD">
<script language="JScript" src="QJScriptLib/log.js"/>
<script language="JScript" src="QJScriptLib/execute.js"/>
<script language="JScript" src="QJScriptLib/reboot.js"/>
<script language="JScript" src="QJscriptLib/msconst.js"/>
<script language="JScript" src="QJscriptLib/QCAPICOM.js"/>
<script language="JScript" src="LocalConsts.js"/>

<script language="JScript">

var MSC;
var wsh;
var fso;
var e;
var x;

MSC = new MSCO ();
LogEvent (4,"RHEV-apt - Started");

// Get WSH Object
wsh = WScript.CreateObject("WScript.Shell");

// Get FileSystemObject Object
fso = new ActiveXObject("Scripting.FileSystemObject");

e = new Enumerator(fso.Drives);
for (; !e.atEnd(); e.moveNext()) {
    x = e.item();
    if (x.DriveType == 4) { //4 = CDROM
        if (VerifyFilesExistance (x.RootFolder + "CDHashes.txt",x.RootFolder)) {
            if (VerifyHashes (x.RootFolder + "CDHashes.txt", strTrustStoreFile, strTrustStorePassword, x.RootFolder)) {
        	    LogEvent (0, "RHEV-apt - found CD");
                ExecAndLog ("%SystemRoot%\\System32\\cscript.exe " + x.RootFolder + "Upgrade.wsf");
            } else {
                LogEvent (1, "RHEV-apt -  Failed due to wrong hashes signature on cd content");
            }
        } else {
            LogEvent (1,"RHEV-apt - Failed because not all signed files could be found");
        }
    }
}

</script>
</job>