ValidateLength Powershell

后端 未结 3 1486
渐次进展
渐次进展 2021-01-20 18:28

This is my first script so don\'t beat me up to bad!

I\'m working on a script that creates a network directory & AD group based on user input. The following is w

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-20 19:01

    You could utilize a while loop:

    $Division = $null
    while ($null -eq $Division) {
        [ValidateLength(2,2)]$Division = [string](Read-Host -Prompt 'Please enter the TWO digit division number ')
    }
    

提交回复
热议问题