Windows PowerShell 4.0 – EMCOPY GUI script

It seems like I am doing heaps of PowerShell scripts lately, but once people find out that you have some experience with it and what it can do they will start lining up.

For this script I was asked to develop a GUI for EMCOPY which is sort of like robocopy but from EMC. There are many switches available and the admin who currently use it tell me that they need to be placed in certain orders and getting this wrong can have drastic consequences. It also needs to be handed to a level one team so it needs to be reasonably simple and foolproof.

This script introduced some new functions that I had not used previously, specifically live modifying of items within a form.


###############################################################################
####                                                                       ####
####                                                                       ####
####                            EMCopy Script                              ####
####                            Version 2.1.2                              ####
####                       Created by: Liam Matthews                       ####
####                                                                       ####
####                                                                       ####
###############################################################################

################################Release notes##################################
####                                                                       ####
################################### 1.0.0 #####################################
#### - Initial release                                                     ####
####                                                                       ####
################################### 1.0.1 #####################################
#### - Anchored the Preview bar to the bottom of the window                ####
#### - Disabled preview text box                                           ####
####                                                                       ####
################################### 2.0.0 #####################################
#### - Added simple screen                                                 ####
#### - Changed log location to be destination folder                       ####
#### - Added /nosec option                                                 ####
####                                                                       ####
################################### 2.0.1 #####################################
#### - Added space betweek /c and /log for preview text                    ####
#### - Added simple options to run command                                 ####
####                                                                       ####
################################### 2.0.2 #####################################
#### - Fixed log file name to contain -LOG on preview and run              ####
####                                                                       ####
################################### 2.0.3 #####################################
#### - Forced script to ignore all errors                                  ####
#### - Added path testing function for source and destination              ####
#### - Run button now enabled by both correct source and destination paths ####
####                                                                       ####
################################### 2.1.0 #####################################
#### - Added confirmation dialog box                                       ####
#### - Modified variables to be global                                     ####
#### - Fixed bug preventing final action from running                      ####
####                                                                       ####
################################### 2.1.1 #####################################
#### - Changed program launcher to Start-Process command                   ####
####                                                                       ####
################################### 2.1.2 #####################################
#### - Changed confirm box and run action to functions                     ####
#### - Changed more variables to be global variables                       ####
#### - Added font to confirm box to fix box not displaying                 ####
####                                                                       ####
###############################################################################

$ErrorActionPreference = 'silentlycontinue'

function EMCOPY
{
 [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
 [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")

 $Action = ""

 #Get date and time
 $Date = Get-Date -Format "yyyy-mm-dd--HH.mm.ss"

 #Set form size
 $Form = New-Object System.Windows.Forms.Form
 $Form.width = 1000
 $Form.height = 850
 $Form.WindowState = "Maximized"
 $Form.Text = "EMCopy options"
 $Form.AutoScroll = $True

 #Set the font of the text to be used within the form
 $Font = New-Object System.Drawing.Font("Times New Roman",12)
 $Form.Font = $Font

 #Create Source CheckBox
 $Global:CheckBox1 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox1.Location = new-object System.Drawing.Size(20,0)
 $Global:CheckBox1.Size = new-object System.Drawing.Size(250,50)
 $Global:CheckBox1.Text = "Source"
 $Global:CheckBox1.Checked = $False
 $Global:CheckBox1.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox1)

 #Create Source TextBox
 $Global:TextBox1 = New-Object System.Windows.Forms.TextBox
 $Global:TextBox1.Location = New-Object System.Drawing.Size(300,10)
 $Global:TextBox1.Size = New-Object System.Drawing.Size(670,50)
 $Global:TextBox1.TabIndex = 1
 $Global:TextBox1.Enabled = $False
 $Global:TextBox1.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $Form.Controls.Add($Global:TextBox1)

 #Create Destination CheckBox
 $Global:CheckBox2 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox2.Location = new-object System.Drawing.Size(20,40)
 $Global:CheckBox2.Size = new-object System.Drawing.Size(250,50)
 $Global:CheckBox2.Text = "Destination"
 $Global:CheckBox2.Checked = $False
 $Global:CheckBox2.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox2)

 #Create Destination TextBox
 $Global:TextBox2 = New-Object System.Windows.Forms.TextBox
 $Global:TextBox2.Location = New-Object System.Drawing.Size(300,50)
 $Global:TextBox2.Size = New-Object System.Drawing.Size(670,50)
 $Global:TextBox2.TabIndex = 1
 $Global:TextBox2.Enabled = $False
 $Global:TextBox2.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $Form.Controls.Add($Global:TextBox2)

 #Create /S CheckBox
 $Global:CheckBox3 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox3.Location = new-object System.Drawing.Size(20,80)
 $Global:CheckBox3.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox3.Text = "Copy all files in the subdirectories"
 $Global:CheckBox3.Checked = $False
 $Global:CheckBox3.Visible = $False
 $Global:CheckBox3.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox3)

 #Create /purge CheckBox
 $Global:CheckBox4 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox4.Location = new-object System.Drawing.Size(20,120)
 $Global:CheckBox4.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox4.Text = "Remove extra files and directories from the destination tree"
 $Global:CheckBox4.Checked = $False
 $Global:CheckBox4.Visible = $False
 $Global:CheckBox4.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox4)

 #Create /SDD CheckBox
 $Global:CheckBox5 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox5.Location = new-object System.Drawing.Size(20,160)
 $Global:CheckBox5.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox5.Text = "Force copy of 'Creation Date' to destination"
 $Global:CheckBox5.Checked = $False
 $Global:CheckBox5.Visible = $False
 $Global:CheckBox5.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox5)

 #Create /D CheckBox
 $Global:CheckBox6 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox6.Location = new-object System.Drawing.Size(20,200)
 $Global:CheckBox6.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox6.Text = "Copy only the source files when its last modification time is greater than the destination file’s modification time"
 $Global:CheckBox6.Checked = $False
 $Global:CheckBox6.Visible = $False
 $Global:CheckBox6.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox6)

 #Create /DE CheckBox
 $Global:CheckBox7 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox7.Location = new-object System.Drawing.Size(20,240)
 $Global:CheckBox7.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox7.Text = "Copy the source file when its last modification time is not equal to the destination file’s modification time or when files size are different"
 $Global:CheckBox7.Checked = $False
 $Global:CheckBox7.Visible = $False
 $Global:CheckBox7.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox7)

 #Create /O CheckBox
 $Global:CheckBox8 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox8.Location = new-object System.Drawing.Size(20,280)
 $Global:CheckBox8.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox8.Text = "Copy owner security information"
 $Global:CheckBox8.Checked = $False
 $Global:CheckBox8.Visible = $False
 $Global:CheckBox8.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox8)

 #Create /secfix CheckBox
 $Global:CheckBox9 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox9.Location = new-object System.Drawing.Size(20,320)
 $Global:CheckBox9.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox9.Text = "Fix the NT security properties on existing destination files or directories"
 $Global:CheckBox9.Checked = $False
 $Global:CheckBox9.Visible = $False
 $Global:CheckBox9.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox9)

 #Create /secforce CheckBox
 $Global:CheckBox10 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox10.Location = new-object System.Drawing.Size(20,360)
 $Global:CheckBox10.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox10.Text = "Overwrite NT security properties"
 $Global:CheckBox10.Checked = $False
 $Global:CheckBox10.Visible = $False
 $Global:CheckBox10.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox10)

 #Create /nosec CheckBox
 $Global:CheckBox11 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox11.Location = new-object System.Drawing.Size(20,400)
 $Global:CheckBox11.Size = new-object System.Drawing.Size(670,50)
 $Global:CheckBox11.Text = "Disable copy of NT security properties"
 $Global:CheckBox11.Checked = $False
 $Global:CheckBox11.Visible = $False
 $Global:CheckBox11.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox11)

 #Create /LG CheckBox
 $Global:CheckBox12 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox12.Location = new-object System.Drawing.Size(20,440)
 $Global:CheckBox12.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox12.Text = "Force copy local group SID"
 $Global:CheckBox12.Checked = $False
 $Global:CheckBox12.Visible = $False
 $Global:CheckBox12.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox12)

 #Create /TH CheckBox
 $Global:CheckBox13 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox13.Location = new-object System.Drawing.Size(20,480)
 $Global:CheckBox13.Size = new-object System.Drawing.Size(250,50)
 $Global:CheckBox13.Text = "Number of working threads"
 $Global:CheckBox13.Checked = $False
 $Global:CheckBox13.Visible = $False
 $Global:CheckBox13.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox13)

 #Create /TH TextBox
 $Global:TextBox3 = New-Object System.Windows.Forms.TextBox
 $Global:TextBox3.Location = New-Object System.Drawing.Size(300,490)
 $Global:TextBox3.Size = New-Object System.Drawing.Size(670,50)
 $Global:TextBox3.TabIndex = 1
 $Global:TextBox3.Enabled = $False
 $Global:TextBox3.Visible = $False
 $Global:TextBox3.Text = "64"
 $Global:TextBox3.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $Form.Controls.Add($Global:TextBox3)

 #Create /R: CheckBox
 $Global:CheckBox14 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox14.Location = new-object System.Drawing.Size(20,520)
 $Global:CheckBox14.Size = new-object System.Drawing.Size(250,50)
 $Global:CheckBox14.Text = "Number of retries"
 $Global:CheckBox14.Checked = $False
 $Global:CheckBox14.Visible = $False
 $Global:CheckBox14.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox14)

 #Create /R: TextBox
 $Global:TextBox4 = New-Object System.Windows.Forms.TextBox
 $Global:TextBox4.Location = New-Object System.Drawing.Size(300,530)
 $Global:TextBox4.Size = New-Object System.Drawing.Size(670,50)
 $Global:TextBox4.TabIndex = 1
 $Global:TextBox4.Enabled = $False
 $Global:TextBox4.Visible = $False
 $Global:TextBox4.Text = "100"
 $Global:TextBox4.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $Form.Controls.Add($Global:TextBox4)

 #Create /W: CheckBox
 $Global:CheckBox15 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox15.Location = new-object System.Drawing.Size(20,560)
 $Global:CheckBox15.Size = new-object System.Drawing.Size(250,50)
 $Global:CheckBox15.Text = "Wait between retries (Seconds)"
 $Global:CheckBox15.Checked = $False
 $Global:CheckBox15.Visible = $False
 $Global:CheckBox15.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox15)

 #Create /W: TextBox
 $Global:TextBox5 = New-Object System.Windows.Forms.TextBox
 $Global:TextBox5.Location = New-Object System.Drawing.Size(300,570)
 $Global:TextBox5.Size = New-Object System.Drawing.Size(670,50)
 $Global:TextBox5.TabIndex = 1
 $Global:TextBox5.Enabled = $False
 $Global:TextBox5.Visible = $False
 $Global:TextBox5.Text = "30"
 $Global:TextBox5.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $Form.Controls.Add($Global:TextBox5)

 #Create /C CheckBox
 $Global:CheckBox16 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox16.Location = new-object System.Drawing.Size(20,600)
 $Global:CheckBox16.Size = new-object System.Drawing.Size(950,50)
 $Global:CheckBox16.Text = "Continue after the number of retries"
 $Global:CheckBox16.Checked = $False
 $Global:CheckBox16.Visible = $False
 $Global:CheckBox16.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox16)

 #Create /LOG CheckBox
 $Global:CheckBox17 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox17.Location = new-object System.Drawing.Size(20,640)
 $Global:CheckBox17.Size = new-object System.Drawing.Size(250,50)
 $Global:CheckBox17.Text = "Log file"
 $Global:CheckBox17.Checked = $False
 $Global:CheckBox17.Visible = $False
 $Global:CheckBox17.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox17)

 #Create /LOG TextBox
 $Global:TextBox6 = New-Object System.Windows.Forms.TextBox
 $Global:TextBox6.Location = New-Object System.Drawing.Size(300,650)
 $Global:TextBox6.Size = New-Object System.Drawing.Size(670,50)
 $Global:TextBox6.TabIndex = 1
 $Global:TextBox6.Enabled = $False
 $Global:TextBox6.Visible = $False
 $Global:TextBox6.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $Form.Controls.Add($Global:TextBox6)

 #Add a simple button
 $SimpleButton = new-object System.Windows.Forms.Button
 $SimpleButton.Location = new-object System.Drawing.Size(10,730)
 $SimpleButton.Size = new-object System.Drawing.Size(80,30)
 $SimpleButton.Text = "Simple"
 $SimpleButton.Add_Click({
 $Global:CheckBox3.Visible = $False
 $Global:CheckBox4.Visible = $False
 $Global:CheckBox5.Visible = $False
 $Global:CheckBox6.Visible = $False
 $Global:CheckBox7.Visible = $False
 $Global:CheckBox8.Visible = $False
 $Global:CheckBox9.Visible = $False
 $Global:CheckBox10.Visible = $False
 $Global:CheckBox11.Visible = $False
 $Global:CheckBox12.Visible = $False
 $Global:CheckBox13.Visible = $False
 $Global:CheckBox14.Visible = $False
 $Global:CheckBox15.Visible = $False
 $Global:CheckBox16.Visible = $False
 $Global:CheckBox17.Visible = $False
 $Global:CheckBox18.Visible = $True
 $Global:CheckBox19.Visible = $True
 $Global:CheckBox20.Visible = $True
 $Global:CheckBox21.Visible = $True
 $Global:CheckBox22.Visible = $True
 $Global:TextBox3.Visible = $False
 $Global:TextBox4.Visible = $False
 $Global:TextBox5.Visible = $False
 $Global:TextBox6.Visible = $False
 $Global:CheckBox3.Checked = $False
 $Global:CheckBox4.Checked = $False
 $Global:CheckBox5.Checked = $False
 $Global:CheckBox6.Checked = $False
 $Global:CheckBox7.Checked = $False
 $Global:CheckBox8.Checked = $False
 $Global:CheckBox9.Checked = $False
 $Global:CheckBox10.Checked = $False
 $Global:CheckBox11.Checked = $False
 $Global:CheckBox12.Checked = $False
 $Global:CheckBox13.Checked = $False
 $Global:CheckBox14.Checked = $False
 $Global:CheckBox15.Checked = $False
 $Global:CheckBox16.Checked = $False
 $Global:CheckBox17.Checked = $False
 $SimpleButton.Enabled = $False
 $AdvancedButton.Enabled = $True
 })
 $SimpleButton.Enabled = $False
 $SimpleButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left
 $form.Controls.Add($SimpleButton)

 #Add an advanced button
 $AdvancedButton = new-object System.Windows.Forms.Button
 $AdvancedButton.Location = new-object System.Drawing.Size(100,730)
 $AdvancedButton.Size = new-object System.Drawing.Size(100,30)
 $AdvancedButton.Text = "Advanced"
 $AdvancedButton.Add_Click({
 $Global:CheckBox3.Visible = $True
 $Global:CheckBox4.Visible = $True
 $Global:CheckBox5.Visible = $True
 $Global:CheckBox6.Visible = $True
 $Global:CheckBox7.Visible = $True
 $Global:CheckBox8.Visible = $True
 $Global:CheckBox9.Visible = $True
 $Global:CheckBox10.Visible = $True
 $Global:CheckBox11.Visible = $True
 $Global:CheckBox12.Visible = $True
 $Global:CheckBox13.Visible = $True
 $Global:CheckBox14.Visible = $True
 $Global:CheckBox15.Visible = $True
 $Global:CheckBox16.Visible = $True
 $Global:CheckBox17.Visible = $True
 $Global:CheckBox18.Visible = $False
 $Global:CheckBox19.Visible = $False
 $Global:CheckBox20.Visible = $False
 $Global:CheckBox21.Visible = $False
 $Global:CheckBox22.Visible = $False
 $Global:TextBox3.Enabled = $False
 $Global:TextBox4.Enabled = $False
 $Global:TextBox5.Enabled = $False
 $Global:TextBox6.Enabled = $False
 $Global:TextBox3.Visible = $True
 $Global:TextBox4.Visible = $True
 $Global:TextBox5.Visible = $True
 $Global:TextBox6.Visible = $True
 $Global:CheckBox18.Checked = $False
 $Global:CheckBox19.Checked = $False
 $Global:CheckBox20.Checked = $False
 $Global:CheckBox21.Checked = $False
 $Global:CheckBox22.Checked = $False
 $SimpleButton.Enabled = $True
 $AdvancedButton.Enabled = $False
 })
 $AdvancedButton.Enabled = $True
 $AdvancedButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left
 $form.Controls.Add($AdvancedButton)

 #Create Option 1 CheckBox
 $Global:CheckBox18 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox18.Location = new-object System.Drawing.Size(20,80)
 $Global:CheckBox18.Size = new-object System.Drawing.Size(670,50)
 $Global:CheckBox18.Text = "Source physical file server - Destination physical file server"
 $Global:CheckBox18.Checked = $False
 $Global:CheckBox18.Visible = $True
 $Global:CheckBox18.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox18)

 #Create Option 2 CheckBox
 $Global:CheckBox19 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox19.Location = new-object System.Drawing.Size(20,120)
 $Global:CheckBox19.Size = new-object System.Drawing.Size(670,50)
 $Global:CheckBox19.Text = "Source physical file server different domain - Destination file server"
 $Global:CheckBox19.Checked = $False
 $Global:CheckBox19.Visible = $True
 $Global:CheckBox19.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox19)

 #Create Option 3 CheckBox
 $Global:CheckBox20 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox20.Location = new-object System.Drawing.Size(20,160)
 $Global:CheckBox20.Size = new-object System.Drawing.Size(670,50)
 $Global:CheckBox20.Text = "Source physical file server same or different domain - Destination NAS"
 $Global:CheckBox20.Checked = $False
 $Global:CheckBox20.Visible = $True
 $Global:CheckBox20.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox20)

 #Create Option 4 CheckBox
 $Global:CheckBox21 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox21.Location = new-object System.Drawing.Size(20,200)
 $Global:CheckBox21.Size = new-object System.Drawing.Size(670,50)
 $Global:CheckBox21.Text = "Source NAS same domain - Destination NAS"
 $Global:CheckBox21.Checked = $False
 $Global:CheckBox21.Visible = $True
 $Global:CheckBox21.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox21)

 #Create Option 5 CheckBox
 $Global:CheckBox22 = new-object System.Windows.Forms.CheckBox
 $Global:CheckBox22.Location = new-object System.Drawing.Size(20,240)
 $Global:CheckBox22.Size = new-object System.Drawing.Size(670,50)
 $Global:CheckBox22.Text = "Source NAS different domain - Destination NAS"
 $Global:CheckBox22.Checked = $False
 $Global:CheckBox22.Visible = $True
 $Global:CheckBox22.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $Form.Controls.Add($Global:CheckBox22)

 #Create preview TextBox
 $Global:TextBox7 = New-Object System.Windows.Forms.TextBox
 $Global:TextBox7.Location = New-Object System.Drawing.Size(100,770)
 $Global:TextBox7.Size = New-Object System.Drawing.Size(700,50)
 $Global:TextBox7.TabIndex = 1
 $Global:TextBox7.Enabled = $False
 $Global:TextBox7.Anchor = [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $Form.Controls.Add($Global:TextBox7)

 #Add a preview button
 $PreviewButton = new-object System.Windows.Forms.Button
 $PreviewButton.Location = new-object System.Drawing.Size(10,770)
 $PreviewButton.Size = new-object System.Drawing.Size(80,30)
 $PreviewButton.Text = "Preview"
 $PreviewButton.Add_Click({
 $Global:Option1 = ""
 $Global:Option2 = ""
 $Global:Option3 = ""
 $Global:Option4 = ""
 $Global:Option5 = ""
 $Global:Option6 = ""
 $Global:Option7 = ""
 $Global:Option8 = ""
 $Global:Option9 = ""
 $Global:Option10 = ""
 $Global:Option11 = ""
 $Global:Option12 = ""
 $Global:Option13 = ""
 $Global:Option14 = ""
 $Global:Option15 = ""
 $Global:Option16 = ""
 $Global:Option17 = ""
 $Global:Option18 = ""
 $Global:Option19 = ""
 $Global:Option20 = ""

 If ($Global:CheckBox1.Checked){$Global:Source = $Global:TextBox1.Text}
 If ($Global:CheckBox2.Checked){$Global:Destination = $Global:TextBox2.Text}
 If ($Global:CheckBox3.Checked){$Global:Option1 = "/S"}
 If ($Global:CheckBox4.Checked){$Global:Option2 = "/purge"}
 If ($Global:CheckBox5.Checked){$Global:Option3 = "/SDD"}
 If ($Global:CheckBox6.Checked){$Global:Option4 = "/D"}
 If ($Global:CheckBox7.Checked){$Global:Option5 = "/DE"}
 If ($Global:CheckBox8.Checked){$Global:Option6 = "/O"}
 If ($Global:CheckBox9.Checked){$Global:Option7 = "/secfix"}
 If ($Global:CheckBox10.Checked){$Global:Option8 = "/secforce"}
 If ($Global:CheckBox11.Checked){$Global:Option9 = "/nosec"}
 If ($Global:CheckBox12.Checked){$Global:Option10 = "/LG"}
 If ($Global:CheckBox13.Checked){$Global:Option11 = "/TH " + $Global:TextBox3.Text}
 If ($Global:CheckBox14.Checked){$Global:Option12 = "/R:" + $Global:TextBox4.Text}
 If ($Global:CheckBox15.Checked){$Global:Option13 = "/W:" + $Global:TextBox5.Text}
 If ($Global:CheckBox16.Checked){$Global:Option14 = "/C"}
 If ($Global:CheckBox17.Checked){$Global:Option15 = "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox18.Checked){$Global:Option16 = "/s /nosec /purge /sdd /de /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox19.Checked){$Global:Option17 = "/s /nosec /purge /sdd /de /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox20.Checked){$Global:Option18 = "/s /purge /sdd /de /o /secfix /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox21.Checked){$Global:Option19 = "/s purge /sdd /de /o /secfix /lg /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox22.Checked){$Global:Option20 = "/s /nosec /purge /sdd /de /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}

 $PreviewText = "EMCOPY64.exe " + $Global:Source + " " + $Global:Destination + " " + $Global:Option1 + " " + $Global:Option2 + " " + $Global:Option3 + " " + $Global:Option4 + " " + $Global:Option5 + " " + $Global:Option6 + " " + $Global:Option7 + " " + $Global:Option8 + " " + $Global:Option9 + " " + $Global:Option10 + " " + $Global:Option11 + " " + $Global:Option12 + " " + $Global:Option13 + " " + $Global:Option14 + " " + $Global:Option15 + " " + $Global:Option16 + " " + $Global:Option17 + " " + $Global:Option18 + " " + $Global:Option19 + " " + $Global:Option20
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $PreviewText = $PreviewText.Replace(" "," ")
 $Global:TextBox7.Text = $PreviewText})
 $PreviewButton.Enabled = $True
 $PreviewButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left
 $form.Controls.Add($PreviewButton)

 #Add a run button
 $RunButton = new-object System.Windows.Forms.Button
 $RunButton.Location = new-object System.Drawing.Size(880,770)
 $RunButton.Size = new-object System.Drawing.Size(80,30)
 $RunButton.Text = "Run"
 $RunButton.Add_Click({
 $global:Action = "Run"
 $Form.Close()
 })
 $RunButton.Enabled = $False
 $RunButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $form.Controls.Add($RunButton)

 #Add a cancel button
 $CancelButton = new-object System.Windows.Forms.Button
 $CancelButton.Location = new-object System.Drawing.Size(810,770)
 $CancelButton.Size = new-object System.Drawing.Size(60,30)
 $CancelButton.Text = "Cancel"
 $CancelButton.Add_Click({
 $global:Action = "Cancel"
 $Form.Close()})
 $CancelButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $form.Controls.Add($CancelButton)

 #CheckBox/TextBox state change options

 [void]$Global:TextBox1.Add_TextChanged({($RunButton.Enabled = $Global:TextBox1.Text) -and ($RunButton.Enabled = $Global:TextBox2.Text) -and ($RunButton.Enabled = Test-Path $Global:TextBox1.Text) -and ($RunButton.Enabled = Test-Path $Global:TextBox2.Text)})

 [void]$Global:TextBox2.Add_TextChanged({($RunButton.Enabled = $Global:TextBox1.Text) -and ($RunButton.Enabled = $Global:TextBox2.Text) -and ($RunButton.Enabled = Test-Path $Global:TextBox1.Text) -and ($RunButton.Enabled = Test-Path $Global:TextBox2.Text)})
 $Global:TextBox2.Add_TextChanged({$Global:TextBox6.Text = "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"})

 #$Global:CheckBox1.Add_CheckStateChanged({($RunButton.Enabled = $Global:CheckBox1.Checked) -and ($RunButton.Enabled = $Global:CheckBox2.Checked)})
 $Global:CheckBox1.Add_CheckStateChanged({$Global:TextBox1.Enabled = $Global:CheckBox1.Checked})
 $Global:CheckBox1.Add_CheckStateChanged({$Global:TextBox1.Text = ""})

 #$Global:CheckBox2.Add_CheckStateChanged({($RunButton.Enabled = $Global:CheckBox1.Checked) -and ($RunButton.Enabled = $Global:CheckBox2.Checked)})
 $Global:CheckBox2.Add_CheckStateChanged({$Global:TextBox2.Enabled = $Global:CheckBox2.Checked})
 $Global:CheckBox2.Add_CheckStateChanged({$Global:TextBox2.Text = ""})

 $Global:CheckBox6.Add_CheckStateChanged({$Global:CheckBox7.Enabled = $Global:CheckBox6.Checked -eq $False})

 $Global:CheckBox7.Add_CheckStateChanged({$Global:CheckBox6.Enabled = $Global:CheckBox7.Checked -eq $False})

 $Global:CheckBox9.Add_CheckStateChanged({$Global:CheckBox10.Enabled = $Global:CheckBox9.Checked -eq $False})
 $Global:CheckBox9.Add_CheckStateChanged({$Global:CheckBox11.Enabled = $Global:CheckBox9.Checked -eq $False})

 $Global:CheckBox10.Add_CheckStateChanged({$Global:CheckBox9.Enabled = $Global:CheckBox10.Checked -eq $False})
 $Global:CheckBox10.Add_CheckStateChanged({$Global:CheckBox11.Enabled = $Global:CheckBox10.Checked -eq $False})

 $Global:CheckBox11.Add_CheckStateChanged({$Global:CheckBox9.Enabled = $Global:CheckBox11.Checked -eq $False})
 $Global:CheckBox11.Add_CheckStateChanged({$Global:CheckBox10.Enabled = $Global:CheckBox11.Checked -eq $False})

 $Global:CheckBox13.Add_CheckStateChanged({$Global:TextBox3.Enabled = $Global:CheckBox13.Checked})
 $Global:CheckBox13.Add_CheckStateChanged({$Global:TextBox3.Text = "64"})

 $Global:CheckBox14.Add_CheckStateChanged({$Global:TextBox4.Enabled = $Global:CheckBox14.Checked})
 $Global:CheckBox14.Add_CheckStateChanged({$Global:TextBox4.Text = "100"})

 $Global:CheckBox15.Add_CheckStateChanged({$Global:TextBox5.Enabled = $Global:CheckBox15.Checked})
 $Global:CheckBox15.Add_CheckStateChanged({$Global:TextBox5.Text = "30"})

 $Global:CheckBox17.Add_CheckStateChanged({$Global:TextBox6.Enabled = $Global:CheckBox17.Checked})
 $Global:CheckBox17.Add_CheckStateChanged({$Global:TextBox6.Text = "c:\emcopy\copy_logs\" + (($Path = $Global:TextBox2.Text).Split("{\}")[-1]) + "-LOG.txt"})

 $Global:CheckBox18.Add_CheckStateChanged({$Global:CheckBox19.Enabled = $Global:CheckBox18.Checked -eq $False})
 $Global:CheckBox18.Add_CheckStateChanged({$Global:CheckBox20.Enabled = $Global:CheckBox18.Checked -eq $False})
 $Global:CheckBox18.Add_CheckStateChanged({$Global:CheckBox21.Enabled = $Global:CheckBox18.Checked -eq $False})
 $Global:CheckBox18.Add_CheckStateChanged({$Global:CheckBox22.Enabled = $Global:CheckBox18.Checked -eq $False})

 $Global:CheckBox19.Add_CheckStateChanged({$Global:CheckBox18.Enabled = $Global:CheckBox19.Checked -eq $False})
 $Global:CheckBox19.Add_CheckStateChanged({$Global:CheckBox20.Enabled = $Global:CheckBox19.Checked -eq $False})
 $Global:CheckBox19.Add_CheckStateChanged({$Global:CheckBox21.Enabled = $Global:CheckBox19.Checked -eq $False})
 $Global:CheckBox19.Add_CheckStateChanged({$Global:CheckBox22.Enabled = $Global:CheckBox19.Checked -eq $False})

 $Global:CheckBox20.Add_CheckStateChanged({$Global:CheckBox18.Enabled = $Global:CheckBox20.Checked -eq $False})
 $Global:CheckBox20.Add_CheckStateChanged({$Global:CheckBox19.Enabled = $Global:CheckBox20.Checked -eq $False})
 $Global:CheckBox20.Add_CheckStateChanged({$Global:CheckBox21.Enabled = $Global:CheckBox20.Checked -eq $False})
 $Global:CheckBox20.Add_CheckStateChanged({$Global:CheckBox22.Enabled = $Global:CheckBox20.Checked -eq $False})

 $Global:CheckBox21.Add_CheckStateChanged({$Global:CheckBox18.Enabled = $Global:CheckBox21.Checked -eq $False})
 $Global:CheckBox21.Add_CheckStateChanged({$Global:CheckBox19.Enabled = $Global:CheckBox21.Checked -eq $False})
 $Global:CheckBox21.Add_CheckStateChanged({$Global:CheckBox20.Enabled = $Global:CheckBox21.Checked -eq $False})
 $Global:CheckBox21.Add_CheckStateChanged({$Global:CheckBox22.Enabled = $Global:CheckBox21.Checked -eq $False})

 $Global:CheckBox22.Add_CheckStateChanged({$Global:CheckBox18.Enabled = $Global:CheckBox22.Checked -eq $False})
 $Global:CheckBox22.Add_CheckStateChanged({$Global:CheckBox19.Enabled = $Global:CheckBox22.Checked -eq $False})
 $Global:CheckBox22.Add_CheckStateChanged({$Global:CheckBox20.Enabled = $Global:CheckBox22.Checked -eq $False})
 $Global:CheckBox22.Add_CheckStateChanged({$Global:CheckBox21.Enabled = $Global:CheckBox22.Checked -eq $False})

 # Activate the form
 $Form.Add_Shown({$Form.Activate()})
 [void] $Form.ShowDialog()

}

function CONFIRM
{

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

 $ConfirmAction = ""

 #Set form size
 $Font = New-Object System.Drawing.Font("Times New Roman",12)
 $ConfirmForm = New-Object System.Windows.Forms.Form
 $ConfirmForm.width = 680
 $ConfirmForm.height = 130
 $ConfirmForm.WindowState = "Normal"
 $ConfirmForm.Text = ”Confirm”
 $ConfirmForm.AutoScroll = $False
 $ConfirmForm.Font = $Font
 $ConfirmForm.TopMost = $True
 $ConfirmForm.FormBorderStyle = "FixedDialog"
 $ConfirmForm.MaximizeBox = $False
 $ConfirmForm.MinimizeBox = $False
 $ConfirmForm.StartPosition = "CenterScreen"
 $ConfirmForm.Font = $Font

 $ConfirmCheckBox1 = new-object System.Windows.Forms.CheckBox
 $ConfirmCheckBox1.Location = new-object System.Drawing.Size(20,0)
 $ConfirmCheckBox1.Size = new-object System.Drawing.Size(660,50)
 $ConfirmCheckBox1.Text = "Correct permissions have been created on destination root folder that the data copy will inherit"
 $ConfirmCheckBox1.Checked = $False
 $ConfirmCheckBox1.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
 $ConfirmForm.Controls.Add($ConfirmCheckBox1)

 #Add a run button
 $ConfirmRunButton = new-object System.Windows.Forms.Button
 $ConfirmRunButton.Location = new-object System.Drawing.Size(540,50)
 $ConfirmRunButton.Size = new-object System.Drawing.Size(80,30)
 $ConfirmRunButton.Text = "Run"
 $ConfirmRunButton.Add_Click({
 $Global:ConfirmAction = "Run"
 $ConfirmForm.Close()})
 $ConfirmRunButton.Enabled = $False
 $ConfirmRunButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $ConfirmForm.Controls.Add($ConfirmRunButton)

 #Add a cancel button
 $ConfirmCancelButton = new-object System.Windows.Forms.Button
 $ConfirmCancelButton.Location = new-object System.Drawing.Size(470,50)
 $ConfirmCancelButton.Size = new-object System.Drawing.Size(60,30)
 $ConfirmCancelButton.Text = "Cancel"
 $ConfirmCancelButton.Add_Click({
 $Global:ConfirmAction = "Cancel"
 $ConfirmForm.Close()})
 $ConfirmCancelButton.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
 $ConfirmForm.Controls.Add($ConfirmCancelButton)

 $ConfirmCheckBox1.Add_CheckStateChanged({$ConfirmRunButton.Enabled = $ConfirmCheckBox1.Checked})

 $ConfirmForm.Add_Shown({$ConfirmForm.Activate()})
 [void] $ConfirmForm.ShowDialog()
}

function RUN
{
 $Global:Option1 = ""
 $Global:Option2 = ""
 $Global:Option3 = ""
 $Global:Option4 = ""
 $Global:Option5 = ""
 $Global:Option6 = ""
 $Global:Option7 = ""
 $Global:Option8 = ""
 $Global:Option9 = ""
 $Global:Option10 = ""
 $Global:Option11 = ""
 $Global:Option12 = ""
 $Global:Option13 = ""
 $Global:Option14 = ""
 $Global:Option15 = ""
 $Global:Option16 = ""
 $Global:Option17 = ""
 $Global:Option18 = ""
 $Global:Option19 = ""
 $Global:Option20 = ""

 If ($Global:CheckBox1.Checked){$Global:Source = $Global:TextBox1.Text}
 If ($Global:CheckBox2.Checked){$Global:Destination = $Global:TextBox2.Text}
 If ($Global:CheckBox3.Checked){$Global:Option1 = "/S"}
 If ($Global:CheckBox4.Checked){$Global:Option2 = "/purge"}
 If ($Global:CheckBox5.Checked){$Global:Option3 = "/SDD"}
 If ($Global:CheckBox6.Checked){$Global:Option4 = "/D"}
 If ($Global:CheckBox7.Checked){$Global:Option5 = "/DE"}
 If ($Global:CheckBox8.Checked){$Global:Option6 = "/O"}
 If ($Global:CheckBox9.Checked){$Global:Option7 = "/secfix"}
 If ($Global:CheckBox10.Checked){$Global:Option8 = "/secforce"}
 If ($Global:CheckBox11.Checked){$Global:Option9 = "/nosec"}
 If ($Global:CheckBox12.Checked){$Global:Option10 = "/LG"}
 If ($Global:CheckBox13.Checked){$Global:Option11 = "/TH " + $Global:TextBox3.Text}
 If ($Global:CheckBox14.Checked){$Global:Option12 = "/R:" + $Global:TextBox4.Text}
 If ($Global:CheckBox15.Checked){$Global:Option13 = "/W:" + $Global:TextBox5.Text}
 If ($Global:CheckBox16.Checked){$Global:Option14 = "/C"}
 If ($Global:CheckBox17.Checked){$Global:Option15 = "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox18.Checked){$Global:Option16 = "/s /nosec /purge /sdd /de /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox19.Checked){$Global:Option17 = "/s /nosec /purge /sdd /de /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox20.Checked){$Global:Option18 = "/s /purge /sdd /de /o /secfix /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox21.Checked){$Global:Option19 = "/s /purge /sdd /de /o /secfix /lg /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}
 If ($Global:CheckBox22.Checked){$Global:Option20 = "/s /nosec /purge /sdd /de /th 32 /r:1 /w:1 /c " + "/LOG+:" + "c:\emcopy\copy_logs\" + ($Path = $Global:TextBox2.Text).Split("{\}")[-1] + "-LOG.txt"}

 $Global:RunAction = " " + $Global:Source + " " + $Global:Destination + " " + $Global:Option1 + " " + $Global:Option2 + " " + $Global:Option3 + " " + $Global:Option4 + " " + $Global:Option5 + " " + $Global:Option6 + " " + $Global:Option7 + " " + $Global:Option8 + " " + $Global:Option9 + " " + $Global:Option10 + " " + $Global:Option11 + " " + $Global:Option12 + " " + $Global:Option13 + " " + $Global:Option14 + " " + $Global:Option15 + " " + $Global:Option16 + " " + $Global:Option17 + " " + $Global:Option18 + " " + $Global:Option19 + " " + $Global:Option20
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")
 $Global:RunAction = $Global:RunAction.Replace(" "," ")

 Start-process .\EMCOPY64.exe $Global:RunAction
}

EMCOPY

IF ($Action -eq "Run"){CONFIRM}

IF ($ConfirmAction -eq "Run"){RUN}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s