2

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

llirik42
  • 23
  • 1
  • 3

1 Answers1

4

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

squillman
  • 37,883
  • 12
  • 92
  • 146
  • Here is what happens when I run from ISE: PS C:\Users\kg> `c:\scripts\Exchange.SharedMailbox.Input.test.ps1 enter group name = .Full: mailbox PS C:\Users\kg>` -- it's taking the line below the read-host and using it as input – llirik42 Oct 24 '13 at 17:29
  • @llirik42 Are you running it from inside the script pane? See the screenshot in my edit. – squillman Oct 24 '13 at 17:31
  • Got it.. I had a comma after "enter group name" It's working now, except it's prompting me on the execution pane, rather than a dialogue box. Not sure if because of version. Either way, I think I'm good. Thanks for your help – llirik42 Oct 24 '13 at 18:04