Start-PowerShellPoint

Working on my PowerShell for Developers presentation I’m doing at our upcoming Devscovery Conference in NYC (April 27-29) it was a no brainer to use Jeffrey Snover’s excellent Start-Demo script (much improved by Joel Bennett). If you’re a bad typist like I am having the demo script is a godsend when showing techniques in a tool like PowerShell. It’s also a great example of a PowerShell script for someone learning PowerShell.

As I worked out my demos, I still needed to have some PowerPoint slides to point out key concepts and things like URLs. As I was putting the slides together something was bothering me. Why was I using PowerPoint? I’m going to be a session on PowerShell. Shouldn’t I be using PowerShell? The first rule of the PowerShell club is to use PowerShell! That’s the second rule as well.

What we were missing was PowerShellPoint, but no longer. At the bottom of this article is the Start-PowerShell.ps1 script I wrote to do my presentation. I’m hoping that others doing PowerShell presentations will use it so PowerShell is the only tool you need to demonstrate PowerShell. So to demo PowerShellPoint, I’ll use PowerShellPoint itself. Just call me Captain Recursion!

Just like PowerPoint, I show that black screen. Press the “p” key to move back into the slides.

Below is the script. If you want to download the script and the demo presentation, click here.

Please do let me know if you find Start-PowerShellPoint useful and if you do extend it!

#requires -version 2

# (c) 2010 by John RobbinsWintellect – Do whatever you want to do with it
# as long as you give credit.

<#.SYNOPSIS
PowerShellPoint is the only way to do a presentation on PowerShell. All
PowerShell all the time!
.DESCRIPTION
If you’re doing a presentation on using PowerShell, there’s Jeffrey Snover’s
excellent Start-Demo, (updated by Joel Bennett (http://poshcode.org/705)) for
running the actual commands. However, to show discussion and bullet points,
everyone switches to PowerPoint. That’s crazy! EVERYTHING should be done in
PowerShell when presenting PowerShell. Hence, PowerShellPoint!

To create your “slides” the format is as follows:
Slide titles start with an exclamation point.
Comment (#) are ignored.
The slide points respect any white space and blank lines you have.
All titles and slide points are indented one character.

Here’s an example slide file:
——
# A comment line that’s ignored.
!First Title
Point 1
Sub Point A
Point 2
Sub Point B
!Second Title
Point 3
Sub Point C
Point 4
Sub Point D
!Third Title
Point 5
Sub Point E
——

The script will validate that no slides contain more points than can be
displayed or individual points will wrap.

The default is to switch the window to 80 x 25 but you can specify the window size
as parameters to the script.

The script properly saves and restores the original screen size and buffer on
exit.

When presenting with PowerShellPoint, use the ‘h’ command to get help.

.PARAMETER File
The file that contains your slides. Defaults to .Slides.txt.
.PARAMETER Width
The width in characters to make the screen and buffer. Defaults to 80.
.PARAMETER Height
The height in characters to make the screen and bugger. Defaults to 25.
#>

param( [string]$File = “.Slides.txt”,
       [int]$Width = 80,
       [int]$Height = 25)

Set-StrictMode –version Latest

$scriptVersion = “1.0”

# Constants you may want to change.
# The foreground and background colors for the title and footer text.
$titleForeground = “Yellow”
$titleBackground = “Black”
# Slide points foreground and background.
$textBackGround = $Host.UI.RawUI.BackgroundColor
$textForeGround = $Host.UI.RawUI.ForegroundColor

# A function for reading in a character swiped from Jaykul’s
# excellect Start-Demo 3.3.3.
function Read-Char()
{
    $inChar=$Host.UI.RawUI.ReadKey(“NoEcho,IncludeKeyUp”)
    # loop until they press a character, so Shift or Ctrl, etc don’t terminate us
    while($inChar.Character -eq 0)
{
$inChar=$Host.UI.RawUI.ReadKey(“NoEcho,IncludeKeyUp”)
}
    return $inChar.Character
}

function ProcessSlides($inputFile)
{
$rawLines = Get-Content $inputFile

    # Contains the actual slides. The key is the slide number and the value are the
    # text lines.
    $slides = @{}

# The slide number I’m processing.
    $slideNumber = 0
    [string[]]$lines = $null

    # Process the raw text by reading it into the hash table.
    for ($i = 0 ; $i -lt $rawLines.Count ; $i++ )
{
# Skip any comment lines.
        if ($rawLines[$i].Trim(” “).StartsWith(“#”))
{
continue
        }

        # Lines starting with “!” are a title.
        if ($rawLines[$i].StartsWith(“!”))
{
if ($lines -ne $null)
{
$slides.Add($slideNumber,$lines)
$lines = $null
}
$slideNumber++
            if ($rawLines[$i].Substring(1).Length -eq 0)
{
throw “You have an empty title slide”
            }
$lines

John Robbins

View Comments

  • Wow, that is totally awesome :D I like that idea!!!
    Maybe I will recreate it using c# just for fun! I will give you credit (of course!!! )

  • Hah, nice :) It might be interesting to see if you could integrate the titles and slide numbers into Write-Progress.
    Lee Holmes [MSFT]

  • This is totally awesome! I'm going to play with this in my sandbox later. Really, really cool stuff.
    Kirk out.
    P.S. When are you going to add all of those flashy PowerPoint animations and presenter mode? ;)

  • Now this is both hugely amusing but insanely sensible. THANKS!
    I am about to convert most of my PPTs to PowerShell Point.
    What a hoot

  • Lee,
    I looked at Write-Progress, but it starts on the second line of the screen and I couldn't see how to control it's display so that it starts on the first line. I do agree that PowerShellPoint would be more PowerShell like with Write-Progress. Maybe I could make that an option in a future version. :)
    Kirk,
    Cool, I'm sure you can find ways to make the script much better. As for the animations and such... I thought about using the buffer stuff in PowerShell for animations, but I need to get my actual presentation done so didn't add it. If I give up sleep, I should be able to get animations worked in. :)
    Thomas,
    Bwahahahaha! PowerShellPoint begins it's world domination!
    Thanks all for the comments everyone!
    - John Robbins

  • Console PowerShell For The Win!
    Seriously John, this is excellent stuff. All that remains is to implement some simple animations like dissolve, slide etc. This isn't too hard to do with the host framebuffer. Hey, why don't you start a codeplex project for this? Join me up - we could hijack Soapyfrog's sprite library ( http://ps1.soapyfrog.com/2007/01/02/space-invaders/ ) and get some in-slide animation routines too!
    -Oisin

Recent Posts

8-Step AWS to Microsoft Azure Migration Strategy

Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…

3 days ago

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

1 week ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

3 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago