$message = "Do you want to (re)install EMET (Enhanced Mitigation Experience Toolkit) and do some default configuration?"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", `
  "Installs (or reinstalls if older version is already installed) EMET and does some default configuration."
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", `
  "Does nothing."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
$result = $host.ui.PromptForChoice($title, $message, $options, 1)
switch ($result) {
  0 {
    Start-Process C:\Windows\System32\msiexec.exe -Wait -ArgumentList '/i "EMET Setup.msi" /passive /norestart'


    $pf = 'C:\Program Files'
    if (Test-Path 'C:\Program Files (x86)') {
      $pf += ' (x86)'
    }
    if (!(Test-Path ($pf + '\EMET 5.5'))) {
      ''
      'NOT AVAILABLE'
      ''
      exit
    }
    $dir = $pf + '\EMET 5.5\Deployment\Protection Profiles\'

    & ($pf + '\EMET 5.5\EMET_Conf.exe') --import ($dir + 'Recommended Software.xml')

    & ($pf + '\EMET 5.5\EMET_Conf.exe') --import ($dir + 'Popular Software.xml')

    & ($pf + '\EMET 5.5\EMET_Conf.exe') --import ($dir + 'CertTrust.xml')


  }
}
