0

Using Start-Process I can call another powershell script within my powershell script.

e.g. Start-Process powershell -argument '.\Another.ps1

The issue is the new Window only has a limited amount of history (i.e. scroll back up to see what was printed out)

Is there any way to increase the history size from Start-Process?

If not, how do you call another powershell script that can have more history size?

user1589188
  • 5,316
  • 17
  • 67
  • 130
  • 1
    `$Size = $Host.UI.RawUI.BufferSize; $Size.Height += 100; $Host.UI.RawUI.BufferSize = $Size` – user4003407 Dec 19 '16 at 05:10
  • @PetSerAl Thanks. How does this relate to the new powershell process? – user1589188 Dec 19 '16 at 08:51
  • It does not. It is the command, which expand buffer size for current PowerShell process. You need to put it in script for new PowerShell process. – user4003407 Dec 19 '16 at 22:17
  • @PetSerAl Thank you. Yeah your code works but I need something to call another script with the expended windows history to start with, can't edit the other script. – user1589188 Dec 22 '16 at 00:03

1 Answers1

0

You can increase the MaximumHistoryCount in this case for that particular session.

Get-Variable MaximumHistoryCount | Select-Object -ExpandProperty attributes

You can set the maximum value then.

Set-Variable -Name MaximumHistoryCount -Value 32767
## Check it again using the range also 
Get-Variable -Name MaximumHistoryCount | Select-Object -ExpandProperty attributes | Format-List -Property *Range

Note: You cannot give value for than 32767. That is the upper limit.

Hope this helps.

Ranadip Dutta
  • 8,857
  • 3
  • 29
  • 45