How to add your knowledge

Revit Server Lock and Save Command-Line Utility

    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.

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

    Command-Line Lock Usage Examples

    NoteThe use of quotations as shown in the examples below is required.

    To lock a folder called "Building 1” under a top folder called "2011 Hospital Project"

    • RevitServer.exe lock -folder "2011 Hospital Project\Building 1"

      OR

    • RevitServer.exe l -f "2011 Hospital Project\Building 1"

    To unlock a folder called "Building 1” under the top folder called "2011 Hospital Project”

    • RevitServer.exe unlock -folder "2011 Hospital Project\Building 1"

      OR

    • RevitServer.exe u -f "2011 Hospital Project\Building 1"

    To lock a specific Model named "As-Built complex" in a folder called "2011 Hospital Project"

    • RevitServer.exe lock -model "2011 Hospital Project\As-Built complex.rvt"

      OR

    • RevitServer.exe l -m "2011 Hospital Project\As-Built complex.rvt"

    Usage:

    RevitServer.exe lock -server

    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>

    RevitServer.exe cancelLock -model <path>

    RevitServer.exe allLocks

    RevitServer.exe verifyLocks [-recreate]

     Building into batch file

    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 and Options

    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).