PowerShell Studio is full of features and options. As a new user, I’m trying to learn as many as I can. There are four options in the Run menu, so, of course, I tried them all. But the result was unexpected.
Run and Run Selection run your code and show the result in the Output pane. Run in Console and Run Selection in Console run your code and show the result in the Console pane, which is a separate Windows PowerShell process that PowerShell Studio hosts. That’s expected.
But Run Selection and Run Selection in Console are very different from each other.
To test the difference, run the following commands as separate selections, first by using Run Selection and then by using Run Selection in Console.
If you use Run Selection, the result of the final “$a” statement is $null, because the assignment statement ran in a different session.
But if you use Run Selection in Console, the result is:
If you need a new Windows PowerShell session in the Console pane, type exit or right-click and click Restart Shell. (If you type powershell, you get a nested session, just like you would in the Windows PowerShell console. To return to the original session, type quit.)
Now that I understand these features, I can use PowerShell Studio more adeptly. And, what about those Archive cmdlets? I’ll save that treat for another article!
June Blender is a technology evangelist at SAPIEN Technologies, Inc. You can reach her at This email address is being protected from spambots. You need JavaScript enabled to view it. and follow her on Twitter at @juneb_get_help.