You can use the Revit Server command-line utility to lock projects on the Revit central server. This is useful for locking models in order to perform scheduled backups. You can also use this utility to save a copy of the specified model as a .rvt file.
After Revit Server installation, the RevitServer.exe tool is located in C:\Program Files\Autodesk\Revit Server 2012\Tools\RevitServerCommand.
To lock a folder called "Building 1” under a top folder called "2011 Hospital Project"
To unlock a folder called "Building 1” under the top folder called "2011 Hospital Project”
To lock a specific Model named "As-Built complex" in a folder called "2011 Hospital Project"
RevitServer.exe lock -folder <path>
RevitServer.exe lock -model <path>
RevitServer.exe unlock -server
RevitServer.exe unlock -folder <path>
RevitServer.exe unlock -model <path>
RevitServer.exe cancelLock -server
RevitServer.exe cancelLock -folder <path>
To make best use of the Revit Server command-line utility its use can be built into .bat files that can quickly be run from the desktop or built into a schedualed task
To create a batch file that will utilise the command line utility to lock the server:
cd "C:\Program Files\Autodesk\Revit Server 2012\Tools\RevitServerCommand\"
revitserver.exe lock -server
To create a batch file that will utilise the command line utility to unlock the server:
cd "C:\Program Files\Autodesk\Revit Server 2012\Tools\RevitServerCommand\"
revitserver.exe unlock -server
For all other commands the above sample syntax can be modified.
| Commands | Result |
|---|---|
| -l, -lock | Lock the specified item. |
| -u, -unlock | Unlock the specified item. |
| -c, -cancelLock | Cancel a lock that is in progress on the specified item. |
| -a, -allLocks | Show all locked/locking items and their status. |
| -v, -verifyLocks | Verify if the lock database is healthy. |
| Options | Result |
|---|---|
| -s, -server | Perform the specified action on the server. |
| -f, -folder <path> | Perform the specified action on the specified folder. |
| -m, -model <path> | Perform the specified action on the specified model. |
| -r, -recreate | Recreate the lock database when it is corrupt. |
| <path> | This is a value for an option. A folder or model path relative to the Revit Server project directory: C:\ProgramData\Autodesk\Revit Server\Projects (This is the default path. The path is determined during the installation process). |