Remove Notes Pages in PowerPoint (PowerShell)

Introduction

This PowerShell script will remove all the notes pages form specified PowerPoint files.

Scenarios

In PowerPoint, people often use the notes function to record additional information. When these documents are shared, you may want to remove notes before sharing the document. Instead of removing the notes one by one, you can remove all the notes using the script.

Note

Removing Notes Pages using script is irreversible and you should take a backup of presentation files before running script. And you must close any running PowerPoint instances before executing this script. This script will close all running PowerPoint instances. 

Script

Step 1: Click Start, type powershell in the search box on the Start Menu, right-click the Windows PowerShell icon, and then click Run Windows PowerShell as administrator. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue
 
Step 2: Run the script in Windows PowerShell Console , type the one command : Import-Module <Script Path> at the command prompt.
For example, type Import-Module E:\TestReview\RemoveNotesInPowerPoint.psm1 This is shown in the following figure. 
Step 3: We can type the command Get-Help Remove-OSCSlideNotes to display the entire help file for this function, such as the syntax, parameters, or examples.
Step 4:  Then you can type the command Remove-OSCSlideNotes –Path <path name>, for example as below 
Or you could specify an absolute path name.
  
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
PowerShell
Edit|Remove
foreach($Slidein$Slides) 
{ 
    if($Slide.NotesPage.Shapes.Count -gt 0) 
    {         
        foreach($Shapein$Slide.Notespage.Shapes) 
        { 
            #remove speaker notes in slidesif($Shape.TextFrame.HasText) 
            { 
                $Shape.TextFrame.TextRange="" 
            } 
        } 
    } 
} 

Prerequisite

Windows PowerShell 2.0
Additional Resources
New-Object
Related forum threads:
http://answers.microsoft.com/thread/a7fd4f03-9759-4556-80be-0eeca59105d0
http://www.ozgrid.com/forum/showthread.php?t=162428