To check in all checked out files in a SOLIDWORKS PDM folder and its subfolders at once, run the PDMShell Check In All Files script. It searches the current folder tree for every locked file, checks them all in with one comment, skips the reference problems that usually stop a bulk check in, and closes PDMShell when it is done. Schedule it and it becomes a nightly safety net.
Files left checked out are a quiet risk in every vault. The latest work sits only on one local drive, nobody else sees the changes, and the next person who needs the file has to chase its owner. Most of the time nobody forgot on purpose. They simply closed SOLIDWORKS at the end of the day. A two line script fixes that.
The complete script
Load it from the PDMShell Script Library, or copy it from the Check In All Files recipe in the PDMShell documentation.
Checkin -search "Name=%;Locked=true;Recursive=true" -comment "checked in by script" -Checkinoptions "EdmUnlock_IgnoreCorruptFile+EdmUnlock_IgnoreRefsOutsideVault+EdmUnlock_IgnoreRefsNotLockedByCaller"
quit -silent
How it works
The search
Name=% matches every file name, Locked=true keeps only files that are checked out, and Recursive=true includes every subfolder below the current PDMShell folder. In other words, every checked out file under where you are standing.
The check in options
A bulk check in usually stops on the first file with an awkward reference. The three options tell PDM to carry on anyway:
- EdmUnlock_IgnoreCorruptFile skips referenced files that cannot be read.
- EdmUnlock_IgnoreRefsOutsideVault ignores references that point outside the vault.
- EdmUnlock_IgnoreRefsNotLockedByCaller ignores references checked out by someone else.
Each file is still checked in normally with the comment checked in by script, so the history shows exactly how it got there.
quit -silent
The last line closes PDMShell without any prompt, which is what you want when the script runs unattended. Remove it if you run the script by hand and want to read the output.
Save it and run it
Save the script with the .pdmshell extension, for example C:\PDMShellScripts\checkinallfiles.pdmshell. Then log in to the vault in PDMShell, change to the folder where the check in should start, and run:
runscript -source "C:\PDMShellScripts\checkinallfiles.pdmshell"
Run it every night with Windows Task Scheduler
Create a scheduled task that starts pdmcli.exe and passes the script:
Program:
C:\Program Files\Blue Byte Systems Inc\PDMShell\pdmcli.exe
Arguments:
/single "runscript -source \"C:\PDMShellScripts\checkinallfiles.pdmshell\""
Run the task under a Windows account that has the vault view and is already logged in to SOLIDWORKS PDM, because the script does not log in by itself. Our post on automating SOLIDWORKS PDM check ins with PDMShell and Windows Task Scheduler covers the scheduling side in detail.
Make it narrower
The default search is deliberately broad. To check in only parts, change the search:
Checkin -search "Name=%.sldprt;Locked=true;Recursive=true" -comment "checked in by script" -Checkinoptions "EdmUnlock_IgnoreCorruptFile+EdmUnlock_IgnoreRefsOutsideVault+EdmUnlock_IgnoreRefsNotLockedByCaller"
To keep a record of what was checked in, add a dump line before the check in:
dump -filePath "checkin-log.txt"
Requirements
- PDMShell already logged in to the correct vault.
- The current PDMShell folder set to where the check in should start.
- Check in permission on the target files.
- Files checked out on the computer running the script, since PDM can only check in files whose local copy is on that machine.
Frequently asked questions
Will it check in files other people have checked out?
Only files that PDM lets the running user check in. Files checked out by another user on another computer stay checked out, because their local changes are not on this machine.
Can I run it on the whole vault?
Yes, by starting from the vault root. Review the folder first, since the search matches every checked out file below it.
Need help automating vault housekeeping?
Nightly check ins are a good start. If you also want stale checkouts reported, files moved to the right folders or references repaired on a schedule, get in touch.