Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string SelectedVM = listBox1.Text.Trim();
            Int64  RAM        = Convert.ToInt64(textBox1.Text.Trim());

            RAM = RAM * 1048576;
            string JSON = "{\"VMName\":\"" + SelectedVM + "\",\"RAM\":" + RAM + "}";

            System.IO.File.WriteAllText(@"C:\Users\parth\Desktop\PowerShellScritp\UpdateRAM.json", JSON);
            CallPowerShell.CallScript(@"C:\Users\parth\Desktop\PowerShellScritp\Update.ps1");
            this.Close();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string SelectedVM = listBox1.Text.Trim();
         string JSON       = "{\"vm_name\":\"" + SelectedVM + "\"}";
         System.IO.File.WriteAllText(@"C:\Users\parth\Desktop\PowerShellScritp\remove.json", JSON);
         CallPowerShell.CallScript(@"C:\Users\parth\Desktop\PowerShellScritp\Remove.ps1");
     }
     catch (Exception ex)
     {
         throw ex.GetBaseException();
     }
     this.Close();
 }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                vm_name = textBox1.Text.Trim();
                vm_ram  = Convert.ToDouble(textBox2.Text.Trim());
                vm_vhd  = Convert.ToDouble(textBox3.Text.Trim());
                vm_nic  = comboBox1.Text.Trim();

                string JSON = "{\"vm_name\":\"" + vm_name + "\",\"vm_ram\":" + vm_ram * 1048576 + ",\"vm_vhd\":" + vm_vhd * 1048576 + ",\"vm_nic\":\"" + vm_nic + "\"}";
                System.IO.File.WriteAllText(@"C:\Users\parth\Desktop\PowerShellScritp\Create.json", JSON);

                //MessageBox.Show("h");
                CallPowerShell.CallScript(@"C:\Users\parth\Desktop\PowerShellScritp\Create.ps1");
                this.Close();
            }
            catch (Exception ex)
            {
                throw ex.GetBaseException();
            }
        }
Example #4
0
        public void BindList()
        {
            try
            {
                CallPowerShell.CallScript(@"C:\Users\parth\Desktop\PowerShellScritp\BindUpdateListBox.ps1");

                JArray objJson = JArray.Parse(File.ReadAllText(@"C:\Users\parth\Desktop\PowerShellScritp\BindUpdateList.json"));
                if (objJson != null)
                {
                    for (int i = 0; i < objJson.Count; i++)
                    {
                        string str1 = objJson[i].ToString();
                        str1 = str1.Split(':')[1];
                        str1 = str1.Split('"')[1];
                        listBox1.Items.Add(str1.Trim());
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex.GetBaseException();
            }
        }