Convert Directory of PPTX into PDF in PowerShell

This post is here for personal reference and was adapted from this link.
The following script allows you to convert a directory of Powerpoint slides into a set of PDFs. I found this particularly useful when I was revising some materials at work that I needed to access from my Android phone.


  1. Open PowerShell
  2. Navigate into the directory that contains all of your PPTX files
    1. Set-Location path\to\pptx\folder
  3. Run the following script:
$ppt = New-Object -com powerpoint.application
$opt = [Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType]::ppSaveAsPDF
Get-ChildItem '.' -Filter '*.pptx' | ForEach-Object {
    $ifile = $_.FullName
    $pres = $ppt.Presentations.Open($ifile)
    $pathname = split-path $ifile $filename = Split-Path $ifile -Leaf
    $file = $filename.split(".")[0]
    $ofile = $pathname + "\" + $file + ".pdf"
    $pres.SaveAs($ofile, $opt)

You might also try adding -Parallel option to the ForEach-Object block to increase performance.

Leave a Reply

Your email address will not be published. Required fields are marked *