Hi All i am new to powershell and trying to work around with for loop or while loop. I am using the following script
$FirstName = Read-Host "Please Enter First Name"
IF([string]::IsNullOrEmpty($FirstName)) {
Write-Host "First Name cannot be left blank Please enter first Name"
} else {
Write-Host "Your Name is" $FirstName
}
If the user does not enter any text i would like powershell to display message again for atleast 3 times to enter first name and than exits it. But dont know how to do it
$FirstName = Read-Host "Please Enter First Name"
IF([string]::IsNullOrEmpty($FirstName)) {
Write-Host "First Name cannot be left blank Please enter first Name"
} else {
Write-Host "Your Name is" $FirstName
}
If the user does not enter any text i would like powershell to display message again for atleast 3 times to enter first name and than exits it. But dont know how to do it