$message = "Do you want to disable AutoRun?"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", `
  "Disables AutoRun."
$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 {
    $dir = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'
    if (!(Test-Path $dir)) {
      New-Item $dir
    }
    Set-ItemProperty $dir -Name NoDriveTypeAutoRun -Type DWORD -Value 255
  }
}
