Disabling Console Apps in PowerShell ISE

by Aug 17, 2012

In PowerShell v3, the new PowerShell ISE script editor has improved a lot. Yet, it still has no real console but instead sports a useful console simulation. Some applications do require a real console, though. If you run those in PowerShell ISE, the editor may become unresponsive. Here is a sample that halts PowerShell ISE because choice.exe waits for input it never receives:

Choice.exe

To prevent this, PowerShell ISE maintains a list of unsupported console applications and won't run them. The list is stored in the variable $psUnsupportedConsoleApplications (which does not exist in the regular PowerShell console).

PS> $psUnsupportedConsoleApplications
wmic
wmic.exe
cmd
cmd.exe
diskpart
diskpart.exe
edit.com
netsh
netsh.exe
nslookup
nslookup.exe
powershell
powershell.exe 

You can improve this list and add applications that you find won't run well in PowerShell ISE. For example, you could add choice.exe to the list:

PS> $psUnsupportedConsoleApplications.Add('choice.exe')

PS> choice.exe
Cannot start "choice.exe". Interactive console applications are not supported. 
To run the application, use the Start-Process cmdlet or use "Start PowerShell.exe" from the File menu.
To view/modify the list of blocked console applications, use $psUnsupportedConsoleApplications, or consult online help.
At line:0 char:0

PS>

Twitter This Tip! ReTweet this Tip!