// Detect OS
var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2");
var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem","WQL");
var enumItems = new Enumerator(colItems);
var OSVersion = 5;

for (; !enumItems.atEnd(); enumItems.moveNext()) {
	var OSfullName = enumItems.item().Caption;
	var objItem = OSfullName.toLowerCase();
	//if (objItem.indexOf("7") != "-1") {
	//  alert(alert_win7notSupport);
	//  window.close(); WScript.Sleep(1);
	//}
	if (objItem.indexOf("vista") != "-1") OSVersion = 6;
	if (objItem.indexOf("7") != "-1") OSVersion = 7;

	if (OSVersion >= 6) {
		// Run as administrator
		if (dpa.commandLine.indexOf('Run') == "-1") {
			var objShell = new ActiveXObject("Shell.Application");
			objShell.ShellExecute("tools\\mshta.exe", dpa.commandLine + " Run", 0 , "runas", 1);
			window.close();
		}
	}
}
