$message = "Do you want to set the maximum number of stored hashes of accounts to 2?"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", `
  "Sets the maximum number of stored hashes of accounts to 2."
$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 NT\CurrentVersion\Winlogon'
    Set-ItemProperty $dir -Name CachedLogonsCount -Type DWORD -Value 2
  }
} 
