powershell with gui to do instant recovery.

PowerShell script exchange

powershell with gui to do instant recovery.

Veeam Logoby larry » Mon Apr 24, 2017 6:37 pm 1 person likes this post

To use you need application groups made, they will point VMs to ESX server to load balance the recovery. I create the groups ahead of time so I know where to recovery each VM. I need to do this as my DR site is also a production site. If this script is not running on a Veeam server then enable and edit line 5 and 7

Wants to run in c:\powershell to save and load settings. The load and save was so I could run as task.

shows how to create dynamic GUI forms in powershell in access Veeam objects.

Hope it helps someone to learn something. I use a Veeam lab appliance to route between esx servers during tests. this allows me to connect real PCs into the lab and allow applications to use DNC,DHCP,Active Directory, file shares and SQL servers as well as use all ESX servers during an DR test. The appliance also supply's the proxy for internet access and Nat to access servers from remote sites. We used this to connect our training lab PCs into our test so users can perform all their functions in our DR simulator. The script was mainly my tool to learn the details of how Veeam works. In the end my test was 100 percent successful. RTO - under 4 hours for 20 servers /RPO under 1 hour. The servers were really ready in 1 hour but connecting end users took longer, leaving RTO at 4 hours knowing it is well within reach.

The end result is an instant recovery of a whole site to 3 ESX hosts at a second production site used for dr.

Code: Select all
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") 

Add-PSSnapin "VeeamPSSnapIn" -ErrorAction SilentlyContinue
#$vbrServer = "172.16.vvv.vvv"
#should have application groups premade to recover to. You will assign each group to a host.
#Connect-VBRServer -server $vbrServer -User "admin" -Password "password"
Connect-VBRServer
$masterlist  = Find-VBRViEntity

#form
$Form = New-Object System.Windows.Forms.Form   
$Form.Size = New-Object System.Drawing.Size(1800,1000)
$form.Text = "DR Test"
#list of application Groups
$AppGroups = @()
$ESXGroup = @()
$ESXFolderGroup = @()
$checkedListVMGroups= @()
$numericUpDown= @()
$ESXResourceGroup = @()
$exportFile = "c:\PowerShell\formControls.xml"
$GImportControlArrays =@()
$loading = $false  #used to see if form is loading from a saved file.


#Form
function functionSave
{
$ControlArrays = @()
$ControlArrays = $Form.Controls

$ControlArrays | Export-Clixml $Global:exportFile

}

function functionLoad
{
$Global:loading = $true
$ControlArrays = @()
$ControlArrays = $Form.Controls


$ImportControlArrays = Import-CliXml  $Global:exportFile
$tempControl = $ImportControlArrays  | where {$_.Name -eq "comboSite"}| Select -Last 1
if ($comboSite.Text -notlike $tempControl.text ) #dont trip change event
   { $comboSite.Text = $tempControl.text

    $Global:GImportControlArrays = $ImportControlArrays
    }
    Else
    {
       foreach ($importControl in $ImportControlArrays)
          {
            #$textBoxLog.AppendText("loading controls " +  $importControl.Name + "`r`n")
            $Global:Form.Refresh();
             if ($importControl.AccessibilityObject.Owner -like "*Forms.Combobox*" )
             {
                $tempcontrol = $form.Controls | where name -eq  ($importControl.Name)
                write-host $tempcontrol.Name
                $tempcontrol.Text = $importControl.Text

             }
             if ($importControl.AccessibilityObject.Owner -like "*Forms.CheckedListBox*" )
             {
               $tempcontrol = $form.Controls | where name -eq  ($importControl.Name)
               $tempcontrol.Items.Clear()
             
              $unchecked=$importControl.Items | ?{$importControl.CheckedItems -notcontains $_}
              $checked=$importControl.CheckedItems
              $i = 0
              foreach ($line in $checked)
                 {
               $tempcontrol.Items.add($line)#add to list
                   $tempcontrol.SetItemchecked($i,$True)
                   $i += 1
         }
                 
              foreach ($line in $unchecked)
                 {
               $tempcontrol.Items.add($line)#add to list

         } 

               

                #$tempcontrol.Items = $importControl.Items

             }
               
           



               
             



          }
     }
}



function functionStart ( $myT)
{
$allESXboxes = $form.controls | Where-Object {($_.name -like "comboesx*")  -and  ($_.name -notlike "*folder") -and  ($_.name -notlike "*Resource")}| Sort Name |Select Name, Text,SelectedItem
$allAppboxes = $form.controls | Where-Object {($_.name -like "comboApp*")} | Sort Name |Select Name ,Text,SelectedItem
$allESXResourceBoxes = $form.controls | Where-Object {($_.name -like "comboesx*")  -and  ($_.name -notlike "*folder") -and  ($_.name -like "*Resource")}| Sort Name |Select Name, Text ,SelectedItem
$allESXfolderboxes = $form.controls | Where-Object {($_.name -like "comboesx*")  -and  ($_.name -like "*folder") -and  ($_.name -notlike "*Resource")}| Sort Name |Select Name, Text ,SelectedItem
$allVMsboxes = $form.controls | Where-Object {($_.name -like "checkedListVM*") }| Sort Name

    $i = 0
     foreach ($AppGroup in $allAppboxes)
     {
         $currentApp =$AppGroup.Text
         $currentESX = $allESXboxes[$i].Text
         $CurrentFolder = $allESXfolderboxes[$i].Text
         $CurrentResource =$allESXResourceBoxes[$i].Text
             
     ##temp need for each item loop
    foreach ($objItem in $allVMsboxes[$i].CheckedItems)

    {
         $currentVM = $objItem
        ### write-host "Current App is $currentApp  Current esx is $currentESX $CurrentFolder $CurrentResource current VM $currentVM "
        $res  = Find-VBRViEntity -ResourcePools -Server $comboSite.Text -Name $CurrentResource
   
     ######default where inside < 0 is dont want just remote SAN snap shots
        $textBoxLog.AppendText("Getting Restore Point: VM $currentVM `r`n")
        $form.Refresh();
        $rp = Get-VBRRestorePoint -Name $currentVM  | Sort CreationTime | where-Object  {$_.InsideDir.length -lt 2} | Select -Last 1
        if ($comboRecoverFrom.Text -eq "Local SAN Snapshot")
        {
          $rp = Get-VBRRestorePoint -Name $currentVM  | Sort CreationTime | where-Object  {($_.Type -eq "Snapshot") -and ($_.InsideDir.length -gt 2) } | Select -Last 1
        }
       if ($comboRecoverFrom.Text -eq "Non-SAN Snapshot")
        {
          $rp = Get-VBRRestorePoint -Name $currentVM  | Sort CreationTime |  where-Object  {($_.Type -ne "Snapshot") } |Select -Last 1
        }

        if ($comboRecoverFrom.Text -eq "Latest Recovery Point")
        {
          $rp = Get-VBRRestorePoint -Name $currentVM  | Sort CreationTime | Select -Last 1
        }

        $server = Get-VBRServer | where {$_.Name -eq $currentESX}
        $folder = Find-VBRViFolder -Server $server -Name $CurrentFolder

        $textBoxLog.AppendText("Loading VM $currentApp - $currentESX  - $CurrentFolder - $CurrentResource current VM $currentVM `r`n")
        $form.Refresh();
        if (($comboPowerOn.text -eq "Power On VMs") -and ($comboNicOn.Text -eq "Connect VM vNics"))
          { 
             Start-VBRInstantRecovery -RestorePoint $rp -VMName $currentVM -Server $server -ResourcePool $res -Folder $folder -PowerUp -NICsEnabled
           }
           if (($comboPowerOn.text -eq "Power On VMs") -and ($comboNicOn.Text -ne "Connect VM vNics"))
          { 
             Start-VBRInstantRecovery -RestorePoint $rp -VMName $currentVM -Server $server -ResourcePool $res -Folder $folder -PowerUp
           }
            if (($comboPowerOn.text -ne "Power On VMs") -and ($comboNicOn.Text -eq "Connect VM vNics"))
          { 
             Start-VBRInstantRecovery -RestorePoint $rp -VMName $currentVM -Server $server -ResourcePool $res -Folder $folder -NICsEnabled
           }
         if (($comboPowerOn.text -ne "Power On VMs") -and ($comboNicOn.Text -ne "Connect VM vNics"))
          { 
             Start-VBRInstantRecovery -RestorePoint $rp -VMName $currentVM -Server $server -ResourcePool $res -Folder $folder
           }


       

       # Start-VBRInstantRecovery -RestorePoint $rp -VMName $currentVM -Server $server -ResourcePool $res -Folder $folder -PowerUp -NICsEnabled
        $t =  Get-VBRInstantRecovery  | where {$_.VMName -eq $currentVM}
        if ($t.Count -gt 0 )
        {
           $textBoxLog.AppendText($t[0].VMName + " Restore point: " + $t[0].BackupName +"-" + $t[0].RestorePoint + " is "+ $t[0].StateString + "  `r`n")
        }
        else
        {
         
           $t =  Get-VBRInstantRecovery -Full | where {$_.VMName -eq $currentVM} | Sort StartTime -Descending | select -First 1
           $Global:textBoxLog.SelectionColor = "Red"
           $textBoxLog.AppendText("Had Error with " + $t[0].VMName + " Restore point: " + $t[0].Parameters.BackupName +"-" + $t[0].Parameters.RestorePoint + " job is "+ $t[0].StateString + "  `r`n")
           $Global:textBoxLog.SelectionColor = "Red"
           $textBoxLog.AppendText("Details of " + $t[0].VMName + " Error: " + $t[0].Description + "  `r`n")
           $Global:textBoxLog.SelectionColor = "Black"
        }

     }
        $i +=1
     }

     $Global:textBoxLog.SelectionColor = "Green"
     $textBoxLog.AppendText("**********Done With VMs ***********  `r`n")
     $Global:textBoxLog.SelectionColor = "Black"

}
function functionESXChange ( $myT)
{

write-host $myT
$newControl = $myT + "Folder"
$control = $form.Controls | where name -eq  $myT
$control2 = $form.Controls | where name -eq  $newControl
$textBoxLog.AppendText("Getting " + $control.Text + " VM Server `r`n")
$form.Refresh();
$server = Get-VBRServer | where {$_.Name -eq $control.Text }
$textBoxLog.AppendText("Getting " + $control.Text + " VM Folders `r`n")
$form.Refresh();
$folders = Find-VBRViFolder -Server $server
$control2.Items.Clear() 
foreach ($folder in $folders)
     {
        $control2.items.add($folder.Name)
        $control2.text = $control2.items[0]
     }

#All Pools
$newControl3 = $myT + "Resource"
$control3 = $form.Controls | where name -eq  $newControl3
#$res  = Find-VBRViEntity -ResourcePools -Server "172.16.52.9"  | where type -eq ResourcePool
$textBoxLog.AppendText("Getting ESX resources `r`n")
$form.Refresh();
$control3.Items.Clear() 
$res  = Find-VBRViEntity -ResourcePools -Server $comboSite.Text  | where type -eq ResourcePool
foreach ($resource in $res)
     {
        $control3.items.add($resource.Name)
        $control3.text = $control3.items[0]
        write-Host "new is"
     }
$Global:textBoxLog.SelectionColor = "Green"
$textBoxLog.AppendText("Now setup another App group or click start `r`n")
$Global:textBoxLog.SelectionColor = "Black"
}



#########Function SiteChange
function functionSiteChange {

 #$esxlist  = Find-VBRViEntity  -Server "172.16.52.9" | where type -eq ESX
 $sitetext = "*" + $comboSite.Text + "*"
$textBoxLog.AppendText("Get All ESX servers `r`n")
$Global:Form.Refresh();
$esxlist  = $masterlist | where type -eq ESX | where path -like $sitetext

write-host $comboSite.Text
 $sitetext = "*" + $comboSite.Text + "*"
if ($Global:AppGroups.Count -gt 0)
{
#write-host "Count is biiggg " $Global:AppGroups.Count

}

$textBoxLog.AppendText("Getting All ApplicationGroup `r`n")
$Global:Form.Refresh();
$Global:AppGroup = Get-VSBApplicationGroup
$i = 1
if ($Global:AppGroups.Count -eq 0 )
   {
   foreach ($Object in $Global:AppGroup)
     {
            $comboApp1 = New-Object  System.Windows.Forms.TextBox
            $comboApp1.Location = New-Object  System.Drawing.Point(49, (85 + ($i * 30)));
            $comboApp1.Name = "comboApp$i";
            $comboApp1.Size = New-Object  System.Drawing.Size(154, 21);
            $comboApp1.TabIndex = 2;
            $comboApp1.Text = $Object.Name


            $Global:AppGroups  += $comboApp1
#write-host $comboApp1.Name
            $Global:Form.Controls.Add($Global:AppGroups[$i-1])
########### list of VMs
            # $checkedListVM.FormattingEnabled = $true;
            $checkedListVM = New-Object  System.Windows.Forms.CheckedListBox
            $checkedListVM.Location = New-Object  System.Drawing.Point(232, (85 + ($i * 30)));
            $checkedListVM.Name = "checkedListVM$i";
            $checkedListVM.Size = New-Object  System.Drawing.Size(136, 19);
            $checkedListVM.TabIndex = 9;
            $textBoxLog.AppendText("Slowly Getting VMs in Application Group " +  $Object.Name + "`r`n")
            $Global:Form.Refresh();
           $AppVMList = [Veeam.Backup.Core.SureBackup.CSbOiag]::GetAllInApplicationGroup($Object.id)
          # write-host $AppVMList
         $vms =@()
          foreach ($VMObject in $AppVMList)
               {
                $vms += Get-VBRRestorePoint | where {$_.objectid -eq $VMObject.Info.ObjectId} | select VMName -Unique
                }
                foreach ($VM in $vms)
               {
                   $checkedListVM.items.add($VM.VMName)
                    $textBoxLog.AppendText("Getting VM " +  $VM.VMName  +"`r`n")
                    $Global:Form.Refresh();
                }
                 For ($v=0;$v -lt $checkedListVM.Items.count;$v++)
                 {
                 $checkedListVM.SetItemchecked($v,$True)
                 }

           $Global:checkedListVMGroups  += $checkedListVM

           $Global:Form.Controls.Add($Global:checkedListVMGroups[$i-1])



 # comboESX1
            #
            $comboESX1 = New-Object  System.Windows.Forms.ComboBox
            $comboESX1.FormattingEnabled = $true;
            $comboESX1.Location = New-Object  System.Drawing.Point(397,  (85 + ($i * 30)));
            $comboESX1.Name = "comboESX$i";
            $comboESX1.Size = New-Object  System.Drawing.Size(137, 21);
            $comboESX1.TabIndex = 5;
            $comboESX1.Text = "Select ESX Server";
           

              foreach ($vc in $esxlist) {
                      $comboESX1.items.add($vc.Name)
            }
            $Global:ESXGroup += $comboESX1
            $Global:Form.Controls.Add( $Global:ESXGroup[$i-1])
            $Global:ESXGroup[$i-1].add_SelectedIndexChanged({functionESXChange $this.Name})               
           
            # # comboESX Folders
            #
            $comboESXFolder = New-Object  System.Windows.Forms.ComboBox
            $comboESXFolder.FormattingEnabled = $true;
            $comboESXFolder.Location = New-Object  System.Drawing.Point(547,  (85 + ($i * 30)));
            $comboESXFolder.Name = "comboESX" + $i + "Folder";
            $comboESXFolder.Size = New-Object  System.Drawing.Size(180, 21);
            $comboESXFolder.TabIndex = 5;
            $comboESXFolder.Text = "Select ESX Server First";
         

              foreach ($vc in $esxlist) {
                    #  $comboESXFolder.items.add($vc.Name)
                              }

            $Global:ESXFolderGroup += $comboESXFolder
           
            $Global:Form.Controls.Add( $Global:ESXFolderGroup[$i-1])
           
            #
             # # comboESX Resources
            #
            $comboESXResource = New-Object  System.Windows.Forms.ComboBox
            $comboESXResource.FormattingEnabled = $true;
            $comboESXResource.Location = New-Object  System.Drawing.Point(750,  (85 + ($i * 30)));
            $comboESXResource.Name = "comboESX" + $i + "Resource";
            $comboESXResource.Size = New-Object  System.Drawing.Size(180, 21);
            $comboESXResource.TabIndex = 5;
            $comboESXResource.Text = "Select ESX Server First";
         

              foreach ($vc in $esxlist) {
                    #  $comboESXFolder.items.add($vc.Name)
                              }

            $Global:ESXResourceGroup += $comboESXResource
           
            $Global:Form.Controls.Add( $Global:ESXResourceGroup[$i-1])
           
            #
            #######numberbox
            $numericUpDown1 = New-Object  System.Windows.Forms.NumericUpDown
            $numericUpDown1.Location = New-Object  System.Drawing.Point(1000,(85 + ($i * 30)));
            $numericUpDown1.Name = "numericUpDown1$i";
            $numericUpDown1.Size = New-Object  System.Drawing.Size(50, 20);
            $numericUpDown1.TabIndex = 6;
            $numericUpDown1.Value = 2;
            $Global:numericUpDown += $numericUpDown1
           
            $Form.Controls.Add( $Global:numericUpDown[$i-1])




            $Form.Refresh()
            $i +=1
           
}
}else
#groups made already
{
write-host $comboApp1.Name
$i = 1
foreach ($Object in $Global:AppGroup)
     {
        $Global:ESXGroup[$i-1].items.Clear()
      foreach ($vc in $esxlist) {
     

           $Global:ESXGroup[$i-1].items.add($vc.Name)
                           }
      $i +=1
     }
 
}
$Global:textBoxLog.SelectionColor = "Green"
 $Global:textBoxLog.AppendText("Now pick a ESX server for the group to run on `r`n")
 $Global:textBoxLog.SelectionColor = "Black"
#$Global:AppGroups = $Local:AppGroups
write-host "Count is " $Global:AppGroups.Count
if ( $Global:loading -eq $true )
    {
    functionload
    }

}
 

            $label1 = New-Object  System.Windows.Forms.Label
            $comboSite = New-Object  System.Windows.Forms.ComboBox
            #$comboApp1 = New-Object  System.Windows.Forms.TextBox
            $label2 = New-Object  System.Windows.Forms.Label
            $label3 = New-Object  System.Windows.Forms.Label
            #$comboESX1 = New-Object  System.Windows.Forms.ComboBox
            $numericUpDown2 = New-Object  System.Windows.Forms.NumericUpDown
            $label7 = New-Object  System.Windows.Forms.Label
            $label8 = New-Object  System.Windows.Forms.Label
            $label9 = New-Object  System.Windows.Forms.Label
            $label10 = New-Object  System.Windows.Forms.Label
            $label11 = New-Object  System.Windows.Forms.Label
            $label4 = New-Object  System.Windows.Forms.Label
            $label5 = New-Object  System.Windows.Forms.Label
           # $checkedListVM = New-Object  System.Windows.Forms.CheckedListBox
            $checkedListBox2 = New-Object  System.Windows.Forms.CheckedListBox
            $textBoxLog = New-Object System.Windows.Forms.RichTextBox
            $txtLoglabel =New-Object System.Windows.Forms.Label
            $comboBox4 = New-Object  System.Windows.Forms.ComboBox
            $comboBox5 = New-Object  System.Windows.Forms.ComboBox
            $buttonStart = New-Object  System.Windows.Forms.Button
            $buttonSave = New-Object  System.Windows.Forms.Button
            $buttonLoad = New-Object  System.Windows.Forms.Button
            $comboRecoverFrom = New-Object  System.Windows.Forms.ComboBox
            $comboPowerOn = New-Object  System.Windows.Forms.ComboBox
            $comboNicOn = New-Object  System.Windows.Forms.ComboBox
            #
           
            $textBoxLog.Location = New-Object System.Drawing.Point(1054, 107);
            $textBoxLog.Multiline = $true;
            $textBoxLog.Name = "textBox1";
            $textBoxLog.ScrollBars = "Both";
                     
            $textBoxLog.Size = New-Object System.Drawing.Size(501, 511);
            $textBoxLog.TabIndex = 16;
            $Form.Controls.Add($textBoxLog)
             $textBoxLog.AppendText("Starting Instant Recovery Script `r`n")
             $textBoxLog.SelectionColor = "Green"
            $textBoxLog.AppendText("Start by Selecting site to recover to, should not be VMs home site if they are still running `r`n")
            $textBoxLog.SelectionColor = "Black"
            $txtLoglabel.AutoSize = $true;
            $txtLoglabel.Location = New-Object System.Drawing.Point(1132, 69);
            $txtLoglabel.Name = "label6";
            $txtLoglabel.Size = New-Object System.Drawing.Size(79, 13);
           $txtLoglabel.TabIndex = 17;
           $txtLoglabel.Text = "Log File Output";
           $Form.Controls.Add( $txtLoglabel)
         
           ##select Recover from
           $label9.AutoSize = $true;
            $label9.Location = New-Object  System.Drawing.Point(1600, 69);
            $label9.Name = "label9";
            $label9.Size = New-Object  System.Drawing.Size(109, 13);
            $label9.TabIndex = 0;
            $label9.Text = "Recovery From:";
            $Form.Controls.Add($label9)
           
            $comboRecoverFrom.Location = New-Object  System.Drawing.Point(1600, 90);
            $comboRecoverFrom.Name = "checkedListVMFrom";
            $comboRecoverFrom.Size = New-Object  System.Drawing.Size(136, 60);
            $comboRecoverFrom.TabIndex = 9;
            $Form.Controls.Add( $comboRecoverFrom)
            $comboRecoverFrom.Items.add("DR SAN Snapshot")
            $comboRecoverFrom.Items.add("Local SAN Snapshot")
            $comboRecoverFrom.Items.add("Non-SAN Snapshot")
            $comboRecoverFrom.Items.add("Latest Recovery Point")
            $comboRecoverFrom.Text = $comboRecoverFrom.Items[0]
            ##selectoptions from
           $label10.AutoSize = $true;
            $label10.Location = New-Object  System.Drawing.Point(1600, 120);
            $label10.Name = "label10";
            $label10.Size = New-Object  System.Drawing.Size(109, 13);
            $label10.TabIndex = 0;
            $label10.Text = "Power VM?:";
            $Form.Controls.Add($label10)
           
            $comboPowerOn.Location = New-Object  System.Drawing.Point(1600, 140);
             $comboPowerOn.Name = "comboPowerOn";
             $comboPowerOn.Size = New-Object  System.Drawing.Size(136, 20);
             $comboPowerOn.TabIndex = 9;
            $Form.Controls.Add($comboPowerOn)
             $comboPowerOn.Items.add("Power On VMs")
             $comboPowerOn.Items.add("Do Not Power On VMs")
             $comboPowerOn.Text =  $comboPowerOn.Items[0]
           
             $label11.AutoSize = $true;
            $label11.Location = New-Object  System.Drawing.Point(1600, 170);
            $label11.Name = "label11";
            $label11.Size = New-Object  System.Drawing.Size(109, 13);
            $label11.TabIndex = 0;
            $label11.Text = "Connect vNics? ";
            $Form.Controls.Add($label11)
           
            $comboNicOn.Location = New-Object  System.Drawing.Point(1600, 190);
            $comboNicOn.Name = "comboNicOn";
            $comboNicOn.Size = New-Object  System.Drawing.Size(136, 20);
            $comboNicOn.TabIndex = 9;
            $Form.Controls.Add($comboNicOn)
            $comboNicOn.Items.add("Connect VM vNics")
            $comboNicOn.Items.add("Do Not Connect vNics")
             $comboNicOn.Text =  $comboNicOn.Items[0]

            # label1
            #
            $label1.AutoSize = $true;
            $label1.Location = New-Object  System.Drawing.Point(29, 26);
            $label1.Name = "label1";
            $label1.Size = New-Object  System.Drawing.Size(109, 13);
            $label1.TabIndex = 0;
            $label1.Text = "Site To Recovery To:";
            $Form.Controls.Add($label1)
            #
            # comboSite
           $vclist  = $masterlist | where type -eq Vc
           
            $comboSite.FormattingEnabled = $true;
            $comboSite.Location = New-Object  System.Drawing.Point(155, 26);
            $comboSite.Name = "comboSite";
            $comboSite.Size = New-Object  System.Drawing.Size(124, 21);
            $comboSite.TabIndex = 1;
            $comboSite.Text = "Select Site";
            foreach ($vc in $vclist) {
                      $comboSite.items.add($vc.Name)
                              }
            $comboSite.add_SelectedIndexChanged({functionSiteChange})

            $Form.Controls.Add($comboSite)
           
            #
            # label2
            #
            $label2.AutoSize = $true;
            $label2.Location = New-Object  System.Drawing.Point(56, 61);
            $label2.Name = "label2";
            $label2.Size = New-Object  System.Drawing.Size(91, 13);
            $label2.TabIndex = 3;
            $label2.Text = "Application Group";
$Form.Controls.Add( $label2)
            #
            # label3
            #
            $label3.AutoSize = $true;
            $label3.Location = New-Object  System.Drawing.Point(394, 61);
            $label3.Name = "label3";
            $label3.Size = New-Object  System.Drawing.Size(112, 13);
            $label3.TabIndex = 4;
            $label3.Text = "ESX Server to Run on";
            $Form.Controls.Add( $label3)
            #
            # label7
            #
            $label7.AutoSize = $true;
            $label7.Location = New-Object  System.Drawing.Point(544, 61);
            $label7.Name = "label3";
            $label7.Size = New-Object  System.Drawing.Size(112, 13);
            $label7.TabIndex = 4;
            $label7.Text = "ESX Folder To Run In";
            $Form.Controls.Add( $label7)
            #
            # numericUpDown1
            #
            # label8
            #
            $label8.AutoSize = $true;
            $label8.Location = New-Object  System.Drawing.Point(750, 61);
            $label8.Name = "label3";
            $label8.Size = New-Object  System.Drawing.Size(112, 13);
            $label8.TabIndex = 4;
            $label8.Text = "ESX Resource";
            $Form.Controls.Add( $label8)
            #
            # numericUpDown1
            #
           
            #
            # label4
            #
            $label4.AutoSize = $true;
            $label4.Location = New-Object  System.Drawing.Point(1000, 61);
            $label4.Name = "label4";
            $label4.Size = New-Object  System.Drawing.Size(81, 13);
            $label4.TabIndex = 7;
            $label4.Text = "Mintues to Wait";
$Form.Controls.Add($label4)
            #
            # label5
            #
            $label5.AutoSize = $true;
            $label5.Location = New-Object  System.Drawing.Point(243, 61);
            $label5.Name = "label5";
            $label5.Size = New-Object  System.Drawing.Size(84, 13);
            $label5.TabIndex = 8;
            $label5.Text = "VMs to Recover";
            $Form.Controls.Add($label5)
            #

            # buttonStart
            #
            $buttonStart.Location = New-Object  System.Drawing.Point(1292, 14);
            $buttonStart.Name = "buttonStart";
            $buttonStart.Size = New-Object  System.Drawing.Size(76, 26);
            $buttonStart.TabIndex = 14;
            $buttonStart.Text = "Start";
            $buttonStart.UseVisualStyleBackColor = $true;
            $buttonStart.Add_Click({functionStart $this.Name}) 
 $Form.Controls.Add( $buttonStart)
            #
            # buttonSave
            #
            $buttonSave.Location = New-Object  System.Drawing.Point(620, 14);
            $buttonSave.Name = "buttonSave";
            $buttonSave.Size = New-Object  System.Drawing.Size(85, 25);
            $buttonSave.TabIndex = 15;
            $buttonSave.Text = "Save Settings";
             $buttonSave.UseVisualStyleBackColor = $true;
            $Form.Controls.Add( $buttonSave)
            # buttonSave
            # button load
            $buttonLoad.Location = New-Object  System.Drawing.Point(720, 14);
            $buttonLoad.Name = "buttonLoad";
            $buttonLoad.Size = New-Object  System.Drawing.Size(85, 25);
           $buttonLoad.TabIndex = 15;
           $buttonLoad.Text = "Load Settings";
            $buttonLoad.UseVisualStyleBackColor = $true;
 
 

            $Form.Controls.Add( $buttonLoad)
            #
            $buttonSave.Add_Click({functionSave $this.Name}) 
            $buttonLoad.Add_Click({functionLoad $this.Name}) 

 
[void] $Form.ShowDialog()



larry
Expert
 
Posts: 383
Liked: 90 times
Joined: Wed Mar 24, 2010 5:47 pm
Full Name: Larry Walker

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest