1

I'm running a basic Powershell script on a remote server, and while it's running, it ignores keyboard input completely. This is intended. When, however, you click anywhere in the Powershell window, it stops input until you clear the pause with a keypress.

Is there some way I can force Powershell to ignore mouse input altogether while the script is running? I want this to be as difficult to close as possible, ie. you need to actually click X to close the window, or kill the process, or the like.

Running in a Command Prompt window instead is acceptable, but I'd rather run it in the Powershell GUI instead if possible.

  • 1
    You mean the PowerShell ISE? The only significant difference between "the Command Prompt window" and the PowerShell command window is the size and color. – Michael Hampton Jul 18 '14 at 18:57
  • 1
    PowerShell doesn't have a GUI. GUI means "Graphical User Interface". PowerShell provides a CLI - Command Line Interface. Maybe a bit nitpicky, but it's driving me crazy about your question. – HopelessN00b Jul 18 '14 at 19:11
  • You're both right. I foolishly believed that the default color palette, summary text at the top of the screen, and different launch method meant it was a seperate executable. Thanks for the knowledge! – jski Jul 18 '14 at 19:13
  • Your description sounds a bit weird - are you using Remote Desktop? Could you, instead, use PowerShell on your local computer and use remoting to launch the script on the remote computer with no UI visible at all? Otherwise, have you considered stackoverflow.com/q/1802127/478656 ? – TessellatingHeckler Jul 18 '14 at 21:35
5

Disable 'Quick-Edit' mode for your powershell console.

quick edit is crap.

  • While this certainly answers my question, is there a way to disable it for certain scripts only? I can definitely see circumstances where being able to copy/paste things out of the console output might be useful. What I'm saying is, being a script-level change would be useful. If not, I can make a seperate shortcut to powershell for "editable" and "noneditable" scripts. – jski Jul 18 '14 at 19:03
  • I haven't found a way, and have looked quite a bit. But that doesn't mean a way doesn't exist. Feel free to update your question to include that requirement. – Zoredache Jul 18 '14 at 19:05
  • Gotcha. I think the "two shortcuts to Powershell" option is the best choice here. Thank you for your assistance :) – jski Jul 18 '14 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.