A common SOLIDWORKS PDM Dispatch action deletes the previous revision of a PDF on a network drive when a drawing is released. It works, but Dispatch runs on the computer of the person who changes the state, under that person’s Windows account. Every user who releases a file needs write access to the network folder, so every user can also delete or overwrite the released PDFs by hand.
Moving the job to a PDM task fixes that. The task runs on a task host under one service account, so the folder can be locked down to that account and stay read-only for everyone else. In this article I set up that task with PDMShell, step by step, with current screenshots of SOLIDWORKS PDM Administration and PDMShell. One script replaces the whole set of Dispatch actions you may have for different file types and workflows.
How it works
- A user releases a drawing or an Office document.
- The release transition starts the Publish Released PDF task on the task host.
- PDMShell deletes the older PDFs of that document from the network folder.
- PDMShell runs your existing Create PDF task with runtask, which prints the PDF for the new revision into the same folder.
Users never write to the network folder. Only the service account on the task host does.
Before you start: licensing
PDMShell has two kinds of license. A computer license activates standalone PDMShell on one computer, which is where you write and test scripts. Vault licenses go into the vault license pool and cover scripts and tasks that run through the PDMShell add-in in SOLIDWORKS PDM. A task host running a PDMShell task takes its seat from the vault license pool.
Open PDMShell, select Settings, then License. Under Vault licenses, pick the vault and choose Manage. Managing the pool needs the Edit add-ins permission in that vault.

In License center, paste your key under Add license keys, choose Add keys, then Save changes. The key shows as Active for the vault.

The PDMShell add-in must also be in the vault. If it is not there yet, open Settings, then Vault add-in, and choose Install / update vault add-in. This affects all vault users and does not use a license on its own.

If you are evaluating, the free PDMShell trial covers everything in this article, and I convert your existing Dispatch actions as part of the trial.
Step 1: Lock down the network folder
On the file server, give the service account Modify permission on the PDF folder, for example \\fileserver\Engineering\Released PDFs. Give everyone else Read only, and remove Modify from any engineering group that had it for Dispatch.
Step 2: Prepare the task host
Pick a computer that stays on and sign in to Windows with the service account. Install the SOLIDWORKS PDM client, PDMShell, and SOLIDWORKS if Create PDF prints SOLIDWORKS drawings. A task runs in the Windows session of the account that is signed in on the task host, so this account is the one that reads and writes the network folder.
Then open Task Host Configuration from the SOLIDWORKS PDM icon in the Windows notification area, select the vault, and check Permit for PDMShell and for the add-in your Create PDF task uses, such as the SOLIDWORKS Task Add-in or PDMPublisher. A task host only runs the add-ins permitted here. Choose OK.


Step 3: Check the Create PDF task
The script prints the PDF with your existing Create PDF task, whether it is a SOLIDWORKS Convert task or a PDMPublisher task. Open it in Administration and on its output page point the output folder to the same network folder. Use a file name format that starts with the document name, then an underscore, then the revision, for example 1001-0042_B.pdf. The cleanup in the script relies on that naming. Set Create PDF to run on the same task host.
Step 4: Create the PDMShell task
In SOLIDWORKS PDM Administration, expand the vault, right-click Tasks and choose New Task.


Name the task Publish Released PDF. On the Add-in page, select PDMShell.

Execute task as user sets the PDM login the task uses. Execute as logged in user uses the PDM account signed in on the task host. You can also pick a dedicated PDM user. Either way, access to the network folder comes from the Windows account on the task host, not from this setting.
On Execution Method, check the task host computer. With Let the system choose the computers to execute the task, PDM sends the task to one of the checked computers.

Step 5: Add the script
Open the PDMShell Script page and paste this script. Change the folder on the second line to your own.
# Folder that holds the published PDFs. Only the service account can write here.
setglobal -name PdfFolder -value "\\fileserver\Engineering\Released PDFs"
setglobal -name BaseName -value "$fileNameWithoutExtension"
# 1. Remove every older PDF of this document
delete -fsSearch "${global.BaseName}_*.pdf" -fsSearchDir "${global.PdfFolder}" -destroy
# 2. Print the PDF for the current revision with the Create PDF task
runtask -filePath "$filePath" -taskName "Create PDF"
Let Claude or ChatGPT write it
You do not have to write this script by hand. The PDMShell commands are documented online, so Claude or ChatGPT can write a script like this from a plain description of what the task must do. Paste the result into the PDMShell Script page and test it before you use it.
setglobal -name PdfFolder -value "\\fileserver\Engineering\Released PDFs"
setglobal -name BaseName -value "$fileNameWithoutExtension"
# 1. Remove every older PDF of this document
delete -fsSearch "${global.BaseName}_*.pdf" -fsSearchDir "${global.PdfFolder}" -destroy
# 2. Print the PDF for the current revision with the Create PDF task
runtask -filePath "$filePath" -taskName "Create PDF"
PDMShell also has AI built in. Choose AI in the PDMShell window to connect ChatGPT, Claude or a local Ollama model, see AI in PDMShell. With the PDMShell MCP server, Claude Desktop can read the exact syntax of every PDMShell command before it writes the script, which avoids made-up parameters. Either way, review the script and run Test With File on a test drawing first.

Here is what each line does:
- setglobal -name PdfFolder stores the network folder once, so you only change the path in one place.
- setglobal -name BaseName stores the name of the file the task is running on, without its extension. For 1001-0042.slddrw it is 1001-0042.
- delete with -fsSearch looks in the network folder for every PDF that starts with that name and an underscore, such as 1001-0042_A.pdf and 1001-0042_B.pdf, and deletes them. -destroy deletes them permanently instead of sending them to the Recycle Bin.
- runtask runs the Create PDF task on the same file. Create PDF then prints the PDF for the current revision into the network folder.
Under Affected documents, set File extensions to the types your Dispatch actions covered, for example slddrw;docx;xlsx. Check Do not use optimized script execution so the whole script finishes for one file before the next file starts.
One thing to watch: the pattern matches every PDF whose name starts with the document name and an underscore. If one document number can be the start of another one followed by an underscore, use a more specific pattern.
Step 6: Error handling and permissions
Expand Error handling. With Stop script after a non-ignored error off, the script still reaches the runtask line if the delete reports a problem, and the task ends as Failed so you see it in the Task List. Turn it on if you would rather stop at the first error.

On Permissions, check the users or groups allowed to start the task. When a workflow transition starts the task, include everyone who can release files. Choose OK to save the task.

Step 7: Start the task on release
Open the workflow and double-click the transition that releases files, Release Documents in this example. On the Actions tab, choose Add Action. In Transition Action, set Type to Execute task, check Run for files, and under Select task to execute pick Publish Released PDF. Choose OK twice. Repeat this for every transition into Released, such as No Approval Required, and for every workflow your Dispatch actions covered. Then remove the old Dispatch actions from those transitions.



Step 8: Test it
On the PDMShell Script page, choose Test With File and pick a test drawing. The test runs the real script, so use a file and a folder you do not mind changing. Then release a test drawing and follow the task under Tasks, Task List. The older PDFs disappear from the network folder and the PDF for the new revision appears.
Get your Dispatch actions converted
If your vault has Dispatch actions like this one, send them to me. I convert them to a single PDMShell script as part of your free PDMShell trial. See Dispatch to PDMShell for how it works.