hi friends
I have prepared a PowerShell script which will be used in an IT training center.
in this center, each student has tree virtual machines on his pc.
when students run my script, it customized multiple parts of OS at once.
at the first line, the script asks users to enter their VM name & VM number & then & saves their responses as a variable & uses this variable in subsequent commands.
$vmname=Read-Host"Please Enter your VM name,for example vm2 & press Enter"
$vmnumber=Read-Host"Please Enter your VM number,for example 2 & press Enter"
now I want to make system only accept valid responses which adhere these patterns:
VMname be only 3 character which only can be one of these tree names: vm1 vm2 vm3
VMnumber be only one character ( digit not any letter ) which can only be 1 or 2 or 3
how can I achieve this via regular expressions in PowerShell ?
thanks a lot in advanced