Please enable JavaScript to view this site.

Navigation: How To Articles > Automating Win2PDF with Microsoft Power Automate Desktop > Win2PDF Power Automate Desktop Example Flows

How To Encrypt PDFs Using Power Automate Desktop

Scroll Prev Top Next More

The following Microsoft Power Automate Desktop flow shows how to encrypt a folder of PDFs in place using the Win2PDF Desktop command line encrypt command.

 

power-automate-desktop-encrypt-pdf-folder-flow

 

To use this "flow", copy the following into a new Power Automate Desktop flow:

 

Display.SelectFolder Description: $'''Select Folder to Encrypt''' IsTopMost: False SelectedFolder=> SelectedFolder ButtonPressed=> ButtonPressed3

Folder.GetFiles Folder: SelectedFolder FileFilter: $'''*.pdf''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files

LOOP FOREACH CurrentItem IN Files

  /# Encrypt the PDF file in place and disable print, copy, and modify permissions using the Win2PDF encrypt command line:

C:\Windows\System32\spool\drivers\x64\3\win2pdfd.exe encrypt "%CurrentItem%" "%CurrentItem%" ffffffe0 256aes "master" ""#/

  System.RunDOSCommand DOSCommandOrApplication: $'''C:\\Windows\\System32\\spool\\drivers\\x64\\3\\win2pdfd.exe encrypt \"%CurrentItem%\" \"%CurrentItem%\" ffffffe0 256aes \"master\" \"\"''' WorkingDirectory: $'''c:\\windows\\system32\\spool\\drivers\\x64\\3\\''' StandardOutput=> CommandOutput StandardError=> CommandErrorOutput ExitCode=> CommandExitCode

END