Help with powershell loop

Navi,
Welcome to the forum. :wave:t4:

Before we proceed … When you post code or sample data or console output please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance

For this case you could use a while loop …

or … a little more sophisticated a choice prompt
https://kpatnayakuni.com/2019/01/15/just-a-tip-6-prompt-for-choice-in-powershell/

https://4sysops.com/archives/read-host-and-the-choicedescription-class-prompt-for-user-input-in-powershell/

https://social.technet.microsoft.com/wiki/contents/articles/24030.powershell-demo-prompt-for-choice.aspx

Regardless of all that - it is considered bad style to use aliasses in scripts. You should avoid them. You may read more about best practices and styles for PowerShell in the

1 Like