Welcome to TechNet Blogs Sign in | Join | Help

Syndication

Archives

[PowerShell] "Ctrl+C" is the key.

Did you ever lost the prompt within the PowerShell console?

I mean, did it happen to you that you pass a cmdlet and the prompt got changed from:

"[PS] C:\>" to ">>"

Plus, in that case whatever you type in the PowerShell console is doing NOTHING without the "natural" possibility to get back to the original prompt.

OK then, so I'm about to be ridiculous for those who know the trick, but it took me a while to understand how to get the prompt back.

Here I am playing with my VMs. Not a fancy thing, just running Exchange Management Shell (EMS) and by-the-way PowerShell to pass some cmdlets on my Exchange Server 2007 organization.

I pass several cmdlet without any problem, just like the one displayed in the following screenshot. REALLY basic stuff. With this cmdlet, I just want the occurrences of all mailboxes homed on a specific Mailbox database. The cmdlet is:

Get-Mailbox -Database:"E2K7-HTCAS\First Storage Group\Mailbox Database" | FT Name

The displayed occurrences are totally relevant with what I know about the situation.

Let's say now that I'm a bit tired and start "misspelling" my cmdlets. I re-run the previous cmdlet but forgot a specific character in the cmdline. In this case, the cmdlet is:

Get-Mailbox -Database"E2K7-HTCAS\First Storage Group\Mailbox Database" | FT Name

Note that ":" is missing just after "Database"

Result is my prompt got changed from "[PS] C:\>" to ">>" without any specific string to pass to return to my prompt.

And that is where the Ctrl+C keyboard shortcut save me as shown in the following screenshot (Thank you MS-DOS memories and CyrilBe!!!)

Th Bad Cmdlet

Honestly, I don't know where the command is locked on, and I didn't find anything about this specific behavior. But I'll be glad to get some explanation on this :-).

J-G@

Published Saturday, May 02, 2009 6:26 PM by Jeremy Gagne

Filed under: , ,

Comments

No Comments

Anonymous comments are disabled
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement  
Page view tracker