Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to reset the runspace in Powershell ISE?

Tags:

One of the features of PowerGUI is the ability to reset the Powershell Runspace as demonstrated in this article and this article. Is it possible to do this in PowerShell ISE?

like image 996
Justin Dearing Avatar asked Sep 07 '11 18:09

Justin Dearing


People also ask

How do I clear PowerShell ISE?

To clear the Console pane, you can click the Clear Console Pane icon on the toolbar, or run the command Clear-Host or its alias, cls .

How do I restart PowerShell ISE?

Restarting of the current tabPress <enter> to accept default of “Yes, restart this tab.” All commands available under “Add-ons” menu for the mouse-fixated. These commands are also bound to hot-keys. EDIT: For the time being, the blog's download link for the ISE Session Tools is broken.

What is Runspace in PowerShell?

In a typical PowerShell session, your console runs in a single runspace. Think of a runspace as a container where everything is stored. Inside of this runspace, code is executed asynchronously. But, PowerShell allows you to create your own runspaces and create as many as you want all at the same time!

Why PowerShell is consuming more memory?

Update the Windows of Your System to the Latest Release You may encounter high CPU usage by the PowerShell if the Windows of your system is outdated (as it may cause the incompatibility between the OS modules). In this case, updating the Windows of your system to the latest release may solve the high CPU usage issue.


2 Answers

(I am using PowerShell V3 ISE on the Win8 Release Preview) You can use File>New PowerShell tab to create a new PowerShell runspace inside the ISE

like image 126
Firaz Samet Avatar answered Oct 03 '22 21:10

Firaz Samet


I wrote a module called "ISE Session Tools" to do this a few months back. Essentially the runspace in ISE is equated to a "Tab" container, of which its child documents share the runspace. My script looks at the current open files, remembers them, creates a new Tab (runspace) and closes the old one, then adds the files you had open to the new Tab. Other features:

  • AutoSaving of current session (files open in current tab.)

This can be disabled and manually controlled if desired.

  • Prompt to reload last session on ISE open

A hint is shown to you reminding you of some of the files you had open. Press <enter> to accept the default of “Yes, reload my last session.”

  • Restarting of the current tab

Essentially cleaning memory and keeping your files open in the editor. You get prompted for this action. Press <enter> to accept default of “Yes, restart this tab.”

All commands available under “Add-ons” menu for the mouse-fixated. These commands are also bound to hot-keys.

See: http://nivot.org/post/2011/02/14/MakingWindowsPowerShellISEGoodEnough


EDIT: For the time being, the blog's download link for the ISE Session Tools is broken. The Internet Archive still has a copy.

like image 42
x0n Avatar answered Oct 03 '22 21:10

x0n