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
Although the various [Validate
... attributes work on variables, it's a non-standard usage (and few people know about them). It works best when you do want to error out.
If you don't, just check it yourself and decide and what to do in the event that it's not what you want:
do {
$Division = [string](Read-Host -Prompt 'Please enter the TWO digit division number ')
if ($Divison.Length -ne 2) {
continue
}
$Matter = [string](Read-Host -Prompt 'Please enter the FOUR digit matter number ')
if ($Matter.Length -ne 4) {
continue
}
$Client = [string](Read-Host -Prompt 'Please enter the FOUR digit client number ')
if ($Client.Length -ne 4) {
continue
}
break
} while ($true)