Powershell Start-Process to run another Powershell script with more history

1.2k views Asked by At

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?

1

There are 1 answers

3
Ranadip Dutta On

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.