I am following a tutorial I found on youtube for a file integrity monitor. The code is messy but im trying to add my own twist and clean it up. I just added input validation and now the code won't run any further after the while loop at the top. Im new to powershell scripting so this may seem like a trivial quesiton but i need some help.
here is the input validation portion:
# Inital message to ask user what they would like to do
$initpromptquestion = "What would you like to do?`n`n A) Collect new baseline.`n`n B) Begin monitoring files with saved baseline.`n`nSelect 'A' or 'B'"
$errormessage = "Invalid entry. Please select 'A' or 'B'."
$selections = @('A','B')
do {
$userinput = Read-Host -Prompt $initpromptquestion
switch($userinput) {
A { return $userinput }
B { return $userinput }
default { Write-Host $errormessage -ForegroundColor DarkRed -BackgroundColor White }
}
} while ($userinput -notcontains $selections)
after this portion is done, the code stops after this. can i get some help?