Let's say you'd like to set the PowerShell console cursor size. This size must be a number between 0 and 100. The following template will validate that the user cannot specify an argument outside the allowed range:
function Set-CursorSize {
param(
[ValidateRange(1,100)]
[Int]
$Percent
)
param(
[ValidateRange(1,100)]
[Int]
$Percent
)
$Host.UI.RawUI.CursorSize = $Percent
}