Exemple #1
0
        public static void gen_backup()
        {
            string script_content = Mysql_Data.get_script("Setup_Recovery_Partition_BIOS.cmd");
            //string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string       path      = "C:\\Windows\\IC\\Setup_Recovery_Partition_BIOS.cmd";
            StreamWriter batwriter = new StreamWriter(path);

            batwriter.WriteLine(script_content);
            batwriter.Close();
        }
        public async void oem_offline_command_action()
        {
            mysql_data.report(obj_onload, Oem_coa, "", Selected_station);
            var shutdown_script = Mysql_Data.get_script("oem_shutdown.bat");

            System.IO.File.AppendAllText(@"w:\Windows\System32\shutdown.bat", shutdown_script);
            await _dialogCoordinator.ShowMessageAsync(this, "Message", "All OEM Tasks Completed, Program will now Shutdown and Begins Backup");

            Application.Current.MainWindow.Close();
        }
Exemple #3
0
        public static void gen_oem_config(string wcoa)
        {
            string script_content = Mysql_Data.get_script("oem_config.bat");

            string       path      = "C:\\Windows\\IC\\config.bat";
            StreamWriter batwriter = new StreamWriter(path);

            batwriter.WriteLine(script_content);
            batwriter.Close();
            Process.Start(path).WaitForExit();
        }
Exemple #4
0
        public static void gen_config(string wcoa, string ocoa)
        {
            string script_content = Mysql_Data.get_script("currentMar_config.bat");

            script_content = script_content.Replace("set win-key=", "set win-key=" + wcoa);
            script_content = script_content.Replace("set office-key=", "set office-key=" + ocoa);
            //  string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string       path      = "C:\\Windows\\IC\\config.bat";
            StreamWriter batwriter = new StreamWriter(path);



            batwriter.WriteLine(script_content);
            batwriter.Close();

            Process.Start(path).WaitForExit();
        }
        //inject commmand into activate.bat and place it in C:\windows\IC
        public async void beta_command_action()
        {
            Mar_enable = false;
            mysql_data.report(obj_onload, Wcoa, Ocoa, Selected_station);
            var script = Mysql_Data.get_script("activate.bat");

            script = script.Replace("Wcoa", Wcoa);
            script = script.Replace("Ocoa", Ocoa);
            System.IO.File.WriteAllText(@"w:\windows\IC\activate.bat", script);
            //w.WriteLine("cscript \"C:\\Windows\\System32\\slmgr.vbs\" /ipk " + Wcoa);
            //w.WriteLine("cscript \"C:\\Windows\\System32\\slmgr.vbs\" /ato");
            //w.WriteLine("cscript \"C:\\Program Files\\Microsoft Office\\Office14\\ospp.vbs\" /inpkey:" + Ocoa);
            //w.WriteLine("cscript \"C:\\Program Files\\Microsoft Office\\Office14\\ospp.vbs\" /act");
            //w.WriteLine("cscript \"C:\\Program Files\\Microsoft Office\\Office14\\ospp.vbs\" /dstatus");
            var shutdown_script = Mysql_Data.get_script("shutdown.bat");

            shutdown_script = shutdown_script.Replace("Wcoa", Wcoa);
            shutdown_script = shutdown_script.Replace("Ocoa", Ocoa);
            //System.IO.File.WriteAllText(@"C:\Windows\System32\shutdown.bat", shutdown_script);
            System.IO.File.AppendAllText(@"w:\Windows\System32\shutdown.bat", shutdown_script);

            XmlDocument doc = new XmlDocument();


            doc.Load("w:\\Windows\\Panther\\unattend.xml");
            XmlNode             root  = doc.DocumentElement;
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            nsmgr.AddNamespace("bk", "urn:schemas-microsoft-com:unattend");
            XmlNode objKeyParent = root.SelectSingleNode("descendant::bk:settings[@pass='******']/bk:component[@processorArchitecture='amd64']", nsmgr);
            var     objKey       = doc.CreateNode("element", "ProductKey", "urn:schemas-microsoft-com:unattend");
            var     objKeyText   = doc.CreateNode("text", "", "");

            objKeyText.InnerText = Wcoa;
            objKey.AppendChild(objKeyText);
            objKeyParent.InsertBefore(objKey, objKeyParent.ChildNodes.Item(0));

            doc.Save("w:\\Windows\\Panther\\unattend.xml");



            await _dialogCoordinator.ShowMessageAsync(this, "Message", "All Tasks Completed, Program will now Shutdown and Begins Backup");

            Application.Current.MainWindow.Close();
        }
Exemple #6
0
        public static void gen_preconfig()
        {
            try
            {
                string script_content = Mysql_Data.get_script("preconfig.bat");
                string path           = "C:\\windows\\IC";
                path = path + "\\preconfig.bat";
                StreamWriter batwriter = new StreamWriter(path);
                batwriter.WriteLine(script_content);

                batwriter.Close();

                Process.Start(path).WaitForExit();
                File.Delete(path);
            }
            catch (Exception e)
            {
            }
        }