Converting Publisher files to PDF with PowerShell

Microsoft published a PowerShell script that converts a folder of .pub files to PDF. It works well, with one big condition: Publisher must be installed and working on that Windows computer.

Updated October 2026

What Microsoft's script does

The script, Convert-PubFileToPDF.ps1, is linked from Microsoft's Publisher end-of-support page. It opens each file in Publisher in the background and saves it as a PDF next to the original. You give it a file filter such as *.pub, and an optional -Recurse switch to include subfolders. Files that already have a PDF are skipped, so you can run it again after an interruption.

What you need

  • A Windows computer with a working, licensed copy of Publisher (for example Publisher 2016, 2019 or 2021).
  • Permission to run scripts. Windows blocks downloaded scripts by default; your IT person can allow it, or you can allow it for one PowerShell window only with Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass.
  • Time: Publisher opens every file one after another, so a large archive takes a while.

When the script isn't an option

Microsoft 365 users lost Publisher around October 1, 2026, and Macs never had it. Without Publisher the script can't run. Your options then:

  • PubFileConverter: drop the folder in your browser, check every page, download the PDFs in the same folders, with a report of anything that didn't convert. How bulk conversion works.
  • LibreOffice on the command line: soffice --headless --convert-to pdf --outdir out *.pub. Free, scriptable, and good for technical users. It renders with the fonts installed on that machine.

Questions

Does the PowerShell script work without Publisher?

No. The script controls Publisher itself, so it needs a Windows computer with a working, licensed copy of Publisher installed.

Can I run it on a Mac?

No. Publisher and the parts of Office the script uses only exist on Windows.