I am trying to write a simple do..until loop and it does not work:
$yesNo = Read-Host -Prompt \'Do you want to add alternative DNS names or IPs
I think you don't need two do-until loop. I also would prefer a do-while (while he is confirming with y or Y).
Your string interpolation on the Add-Content doesn't work because you are using single quotes. I would leverage a format string here:
$yesNo = Read-Host -prompt 'Do you want to add alternative DNS names or IPs into Certificate? Y/N: '
if ($yesNo -eq 'y')
{
do
{
$dnsipname = read-host -prompt "Please input DNS or IP as dns=alternativeCNname or ip=ipName: "
Write-output "$dnsipname"
Add-Content -Path "D:\Scripts\expiringCerts\request.inf" -value ('`r`n_continue_ = "{0}"' -f $dnsipname)
$strQuit = Read-Host " do you want to add another DNS? (Y/N)"
}
while($strQuit -eq 'y')
}