A desktop publishing application from Microsoft that focuses on page layout and graphic design.
The path error others have covered, so I won't repeat it — and Shawn's revised script above is genuinely better than the original if you stay on the PowerShell route, particularly the long-path handling.
But it's worth saying plainly: your frustration is fair. The documentation calls this easy, and for anyone who doesn't already live in PowerShell it isn't. Execution policy, working directory, the Office.dll path — three separate things that each fail with an unhelpful message.
If you'd rather skip PowerShell altogether, I wrote a script that does the same job as a double-click. Same underlying approach — it drives your installed copy of Publisher via ExportAsFixedFormat, so the PDFs are rendered by Publisher itself and come out identical to a manual export. It walks sub-folders, opens each file read-only, writes a CSV log, and skips anything already converted, so if it stops on a damaged file you move that one aside and run it again rather than starting over.
Free, no sign-up, nothing uploaded. There's a .bas macro version in the same download for machines where IT blocks script files.
Full disclosure: I wrote it. I also do paid rebuilds of Publisher templates, which is a separate thing and not what you asked about. For a few thousand files, either route works — mine just has fewer places to fall over.