As a Microsoft Certified Trainer, mainly teaching Windows PowerShell courses, I spend a lot of my time presenting demos in the PowerShell ISE. During demos, I’m facing some problems within the PowerShell ISE – maybe this looks similar to you:
- Putting the cursor on the right line
- Selecting the correct statement to execute
- Just hit F8 to execute the line
- Never hit F5 (or add a break statement to the first line)
- Execute a line twice on accident
- Don’t forget on which line I was
- and so on …
As a presenter, you have to take care of all of that besides commenting it in a useful way. So a demo may fail even if the code is fine – just because of the execution. The other challenge during demos: I have to be behind the screen to operate m the keyboard and mice.
To improve the demo experience for me as a teacher and for the students, I’ve developed a tool which should meet the following requirements:
- Providing guidance during demo by executing statement by statement
- Make the current statement visible by selecting/highlighting it
- Be flexible to go back and forward
- Enable remote control of the PowerShell ISE
ISEPresenter Add-On Module
As a solution, I’ve developed a PowerShell ISE Add-On module called ISEPresenter a while ago. With ISEPresenter, it’s possible to play demos with a remote control like the Logitech Presenter R400 or a (wireless) keyboard. The ISEPresenter Add-On will take care of highlighting the current statement, executing the highlighted statements and provides the possibility to go back and forward.
Of course you can download and install it from the PowerShell Gallery.
Install-Module ISEPresenter # Execute within the ISE Import-Module ISEPresenter
To start a presentation, just load a script into the ISE. In ideal case, the script should be prepared to run step by step from top to bottom. To control the ISE with the ISEPresenter, you can use the Play, Pause and Stop buttons. While the presenter is active, it will override the built-in keys of the ISE like F5 and F8 and redirect them to the presenter. The presenter has four basic actions:
Executes the currently selected line and, if selected, highlight the next statement after completion.
Clear the output screen of the console. As normally in the ISE, it will not reset the console.
Select the previous line.
Select the next line.
The ISEPresenter does automatically parse the script into a list of statements, not lines. So multi-line statements, like hash tables or script blocks can be, are supported. Depending on the selected device, the basic actions can be controlled by keyboard (F5, F8, DEL, Page Up, Page Down) or by the Logitech Presenter R400 with the dedicated buttons.
I hope this is useful and therefore I’ve put it on GitHub. Contributions, especially for other remote devices, are very welcome. Wish you happy presenting, with or without ISEPresenter.