PowerAddict.net

powerAddict.NET

by Lou Goban
IT Application Professional at Syntax

Make Read-Host input mandatory

If you want to make your interactive PowerShell script input with Read-Host mandatory, use this:

Do {
    Write-Host "Enter First Name: *" -ForegroundColor Yellow
    $FirstName = Read-Host
}
Until (!([string]::IsNullOrEmpty($FirstName)))

Leave the first comment