Powershell to repeat the User Input when the result is not match to the pattern?

People,

I need some assistance in modifying the script below to keep on prompting the users when the input is not the correct IP address format.

The script below will dump the result into Out-GridView for all DNS entries which contain the user input.

function Test-IPaddress {
    [CmdletBinding(SupportsShouldProcess)]
    Param (
        [Parameter(Mandatory = $true,
                  ValueFromPipelineByPropertyName = $true,Position = 0)]
                  [ValidateScript({$_ -match [IPAddress]$_ })]
                  [string]$IPAddress
    )

    Process{[ipaddress]$IPAddress}
}

Try {
    $DNSServer = '1.1.1.1'
    $IPAddress = $((Test-IPaddress -IPAddress (Read-Host -Prompt 'Input a valid IP address')).IPAddressToString)

    $zones = Get-DnsServerZone -ComputerName $DNSServer | Where-Object { !$_.IsReverseLookupZone -and $_.ZoneType -eq 'Primary' }
    $output = foreach ($zone in $zones) {
       Get-DnsServerResourceRecord -ComputerName $DNSServer -ZoneName $zone.ZoneName |
       Where-Object { $_.RecordData.Ipv4Address.IPAddressToString -contains $IPAddress } |
       Select-Object HostName, RecordType, Type, RecordData, Timestamp, TimeToLive, @{ n = 'Zone'; e = { $zone.ZoneName } }
    }
    $output | Out-GridView -Title "IPAddress details for $IPAddress - $((Resolve-DnsName -Server $DNSServer -type A $IPaddress).Name) - Using DNS Server $($DNSServer)"
    
}
Catch {
    Add-Type -AssemblyName  System.Drawing,
                            PresentationCore,
                            PresentationFramework,
                            System.Windows.Forms,
                            microsoft.VisualBasic
    [System.Windows.Forms.Application]::EnableVisualStyles()

    [System.Windows.Forms.MessageBox]::Show("Warning message for $IPAddress`n 
    $($PSItem.Exception.Message)" , 'Error', 'OK', 'Error')
}

Note: How can the Error message box be brought to the top (AlwaysOnTop) to bring up the user attention?

Thank you in advance.