The ValidateLength attribute

ValidateLength can be applied to a String parameter or a parameter that contains an array of strings. Each string will be tested against the minimum and maximum length:

function Test-ValidateLength {
[CmdletBinding()]
param (
[ValidateLength(2, 6)]
[String[]]$Parameter1
)
}

Any string with a length below the minimum, or above the maximum, will trigger an error.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.104.109