Table of Contents

Update References and Check In

Select a vault folder. The script checks that the target is a folder, then performs three bulk operations in order:

  1. Check out checked-in files in that folder and all subfolders.
  2. Update references for files checked out by you on this computer.
  3. Check those files back in with the comment "References updated by PDMShell".

Download the script, or choose Update References and Check In in the PDMShell Script Library. No per-file helper or search favorite is required.

Warning

This changes real files and checks changes into PDM. The final search includes pre-existing checkouts by you on this computer within the selected folder tree, not only checkouts created by this run. Review those files first. Files checked out by other users or on other computers are excluded from the update and check-in searches. Test on a small, backed-up project first.

Run

  1. Log in to the intended vault and load the template in the standalone visual editor.
  2. Choose Run > Browse to Folder and select the folder to process. Do not use Run without a selection: if a current folder is available, it may be used as the target.
  3. If selecting multiple folders, enable Do not use optimized script execution so each folder completes the entire sequence before the next starts. Avoid selecting both a parent folder and one of its children.
  4. Keep stop-on-error behavior. Standalone visual Run stops on command errors. For a saved vault script, enable Stop script after a non-ignored error under Handling and leave checkout-error ignore options off. Do not use the console's runscript command for this template; that runner can continue into check-in after an error.

The first condition uses an actual folder-existence check, not a filename-extension test. File selections, including files without an extension, show a message and perform no checkout, update, or check-in. Folder names containing dots or spaces are supported.

Every search includes Recursive=true and the selected FolderID, so it is explicitly scoped to that folder tree. Only files are returned. The reference lookup directory is also the selected folder; replacement references in sibling folders outside that tree are not searched.

Script

If folder exists "$localPath" GoTo Folder_UpdateReferencesAndCheckIn
msgbox -value "Select a vault folder, not a file, to update references recursively." -icon "Information"
GoTo End_UpdateReferencesAndCheckIn
Folder_UpdateReferencesAndCheckIn:
cd -directory "$localPath"
checkout -search "Name=%;FolderID=$folderID;FindFiles=true;FindFolders=false;Locked=false;Recursive=true"
updatereferences -search "Name=%;FolderID=$folderID;FindFiles=true;FindFolders=false;Locked=true;LockedBy=$userName;LockedOnComputer=$computerName;Recursive=true" -directory "$localPath" -scope UpdateAllReferences -csv "$tempFolder\PDMShell-reference-update-$folderID-$GUID.csv"
checkin -search "Name=%;FolderID=$folderID;FindFiles=true;FindFolders=false;Locked=true;LockedBy=$userName;LockedOnComputer=$computerName;Recursive=true" -comment "References updated by PDMShell"
End_UpdateReferencesAndCheckIn:

Behavior and reports

  • This is deliberately a bulk search workflow, not a per-file checkout/update/check-in loop.
  • The search targets all file types. Formats unsupported by PDM's raw reference manager, such as some PDFs or Office files, are recorded as Unsupported. They can cause the update command to fail; restrict the Name filter in all three searches if your folder contains unrelated files.
  • UpdateAllReferences uses the first matching filename found within the lookup scope. Review duplicate filenames. You can instead choose UpdateBrokenReferences or UpdateOutsideVaultReferenceOnly.
  • Individual reference-update failures do not stop that command from processing its remaining search results. With stop-on-error enabled, a failed batch then stops the script before the final check-in command.
  • An unsuccessful run can leave many files checked out, including files whose updates succeeded. Review the report and command log before deciding what to check in. There is no automatic rollback and no unconditional "check in everything" after a failure.
  • The report is saved outside the vault in the Windows temporary folder as PDMShell-reference-update-$folderID-$GUID.csv. Its columns are ID,Name,Old Reference,New Reference,Status,Error,HRESULT. It covers the reference-update step, not checkout or check-in; setup failures may prevent report creation.
  • Files remain in their existing vault folders. This does not move files, change vaults, launch SOLIDWORKS, or bypass PDM permissions.
  • This nine-line script exceeds the Free five-line script limit. For an unattended task, remove or replace the invalid-selection message box and explicitly configure folder targets and stop-on-error handling.

Related: reference updates, checkout, check-in, run options, and script handling.