I've never been able to get the AllowEmptyString validation attribute to work.
This:
function Get-InputString(
[parameter(mandatory=$true, position=0)][string][AllowEmptyString]$Str
)
{
$Str
}
Results in this:
PS C:\> Get-InputString ''
Unable to find type [AllowEmptyString]: make sure that the assembly containing this type is loaded.
At line:2 char:71
+ [parameter(mandatory=$true, position=0)][string][AllowEmptyString] <<<< $Str
+ CategoryInfo : InvalidOperation: (AllowEmptyString:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound