Revit Server Lock Command-Line Utility

To prepare for scheduled backups, you can use the Revit Server command-line utility to lock and unlock a Revit Server Host or specific folders or models therein.

This utility also lets you view the status of locked items, verify the health of the database, and recreate it if it is corrupt.

After Revit Server installation, the RevitServer.exe tool is located in C:\Program Files\Autodesk\Revit Server 2023 Release\Tools\RevitServerCommand.

Note: In order to use this command-line utility, you should be familiar with DOS and understand the structure of command lines.

Commands and Options

Commands Result
-l, -lock Locks the specified item.
-u, -unlock Unlocks the specified item.
-c, -cancelLock Cancels a lock that is in progress on the specified item.
-a, -allLocks Shows all locked/locking items and their status.
-v, -verifyLocks Verifies if the lock database is healthy.
Options Result
-s, -server Performs the specified action on the server where the utility is run.
-f, -folder <path> Performs the specified action on the specified folder.
-m, -model <path> Performs the specified action on the specified model.
-r, -recreate Recreates the lock database when it is corrupt.
<path> Specifies the path for the folder or model being locked/unlocked relative to the Revit Server project directory: C:\ProgramData\Autodesk\Revit Server2023 Release\Projects (This is the default path. The path is specified during the installation process).

Command-Line Lock Usage Examples

Note: The use of quotation marks in the examples below is required to correctly process arguments containing spaces.

To lock a folder named 2023 Release Hospital Project\Building 1

  • RevitServer -lock -folder "2023 Release Hospital Project\Building 1"

    OR

  • RevitServer -l -f "2023 Release Hospital Project\Building 1"

To unlock a folder named 2023 Release Hospital Project\Building 1

  • RevitServer -unlock -folder "2023 Release Hospital Project\Building 1"

To lock a specific Model named As-Built complex

The model is in a folder named 2023 Release Hospital Project.

  • RevitServer -lock -model "2023 Release Hospital Project\As-Built complex.rvt"

    OR

  • RevitServer -l -m "2023 Release Hospital Project\As-Built complex.rvt"

Usage:

RevitServer lock -server

RevitServer lock -folder <path>

RevitServer lock -model <path>

RevitServer unlock -server

RevitServer unlock -folder <path>

RevitServer unlock -model <path>

RevitServer cancelLock -server

RevitServer cancelLock -folder <path>

RevitServer cancelLock -model <path>

RevitServer allLocks

RevitServer verifyLocks [-recreate]