var strQumranetRebbotModeReg = "HKLM\\SOFTWARE\\Redhat\\CDAutoUpgrader\\ExecMode";

function Reboot () {
	var oComputer;
	var n;
	var opSys;
	var strName = ".";

	oComputer = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\\\.\\root\\cimv2").ExecQuery("select * from Win32_OperatingSystem");

	n = new Enumerator (oComputer);

	for (;!n.atEnd(); n.moveNext()) {
		opSys = n.item();
		opSys.Win32Shutdown(2+4); // Forced Reboot (2= reboot, 4=force)
	}

}

function RebootWithMode (strMode) {
	SetRebootMode (strMode);
	Reboot();

}

function ClearRebootMode () {
	SetRebootMode ("");
}

function SetRebootMode (strMode) {
	var wsh;

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

	wsh.regWrite (strQumranetRebbotModeReg, strMode, "REG_SZ");

}

function GetRebootMode () {
	var wsh;
	var strExecMode;

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

	try {
		strExecMode = wsh.regRead (strQumranetRebbotModeReg);
	} catch (e) {
		LogEvent (2, strQumranetRebbotModeReg + "Does not exist, CDAutoUpgrader will automatically create it");
		SetRebootMode ("");
		strExecMode = "";
	}

	return (strExecMode);
}