PowerTip: Prompt for Input for PowerShell Script
Summary: Learn how to prompt for input for your Windows PowerShell script.
How can I use Windows PowerShell as an easy way to prompt a user for information for my script?
Use Read-Host, for example:
$a = Read-Host -Prompt "enter your input"
The users input is stored in the $a variable.
Note Depending on what you are doing, using unchecked user input for your script can be dangerous.
It is best to limit user input to prespecified actions. The second best thing is to check the user input to
ensure that it meets certain requirements.