Powershell Read-host does not stop for input

powershell

I thought this would be fairly basic, but i'm stuck.
I have 3 lines of powershell script in which I want to collect a mailbox name from user input, then create names based on that mailbox name. (later the script proceeds to create the groups in AD, etc)
my problem is that when I run all 3 of these lines by pasting them into powershell window, I don't get a change to enter the response to read-host. Instead the script just scrolls through to the next line and uses it as the response for the Read-Host
here's the powershell:

$name = read-host "enter group name"
$groupfull = ($name+'.Full'a)
$groupsendas = ($name+'.SendAs')

Here's the output:

PS C:\Users\kg> $name = read-host "enter group name"
enter group name: $groupfull = ($name+'.Full')
PS C:\Users\kg> $groupsendas = ($name+'.SendAs')
PS C:\Users\kg>

Thanks in advance

Best Answer

From a powershell shell window you will need to enter them one at a time. If you want to do all three at once you should run them from a script file or within an IDE such as ISE. You can run them from the script pane of ISE (enter the code, hit the Run Script button or F5).

Here it is in ISE: enter image description here