powershell Read-host does not stop for input

Posted by llirik42 on Server Fault See other posts from Server Fault or by llirik42
Published on 2013-10-24T14:54:49Z Indexed on 2013/10/24 15:57 UTC
Read the original article Hit count: 236

Filed under:

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

© Server Fault or respective owner

Related posts about powershell