<#
	.SYNOPSIS
		Prompt user for [y/n] confirmation.
	.NOTES
		* Consider:
		If a cmdlet supports the -confirm parameter, it can be forced to prompt before any action.
		I just like version #1 because it's concise.
#>

# Version #1
$msg = "Are you sure you wish to commit this action?"
while ( -not ( ($choice = (Read-Host $msg)) -match "y|n")) { $msg = "Please specify [y/n]" }
if ($choice -notmatch "[yY]") { break }

# Version #2
$Caption = "Confirm"
$Message = "Are You Sure?"
$Yes = New-Object System.Management.Automation.Host.Choicedescription "&Yes", "Help"
$No = New-Object System.Management.Automation.Host.Choicedescription "&No", "Help"
$Choices = [System.Management.Automation.Host.Choicedescription[]]($Yes, $No)
$Answer = $Host.Ui.Promptforchoice($Caption, $Message, $Choices, 0)

Switch ($Answer) {
	0 { "You Entered 0"; Break }
	1 { "You Entered 1"; Break }
}