the desired output would be to repeat the question until either "Y" or "N" is selected.
$msg = 'Does this Share contain Sensitive Data? [Y/N]'
do {
$response = Read-Host -Prompt $msg
if ($response -eq 'n') {
$sdata = "No"
}
if ($response -eq 'y') {
$sdata = "(Sensitive)"
}
} until ($response -ne '$null')
However if I enter anything else it will still continue to run the script. I have this working on other scripts so I am unsure of why its not working now.
Thanks as always!