Batch & Time Triggers
Now that we sent data to the database, we may want to keep it up to date automatically.
Indexing via a Batch File
All operations can be executed via a batch file, including opening Navisworks, connecting to our Dumpster, and running all the required steps.
A batch file always starts with the path of the version of MoQu to use, located in C:\ProgramData\Autodesk\ApplicationPlugins\MoQu.bundle\N##\MoQu.exe.
In addition, MoQu has a number of mandatory and optional switches, each switch being a double dash, a name, an equal sign and a value without space: --switchname=switchvalue
The following switches are mandatory:
--connection: the connection string to use for the database e.g. server=<servername>;database=<dbname>;trusted_connection=True;Encrypt=False
--schema: the name of the schema to target, this is your Dumpster name
--project: the id of the project to run the indexing for, you can find your project id from the App > Configuration > Repositories > Settings
--silent: to run without a GUI
The following switches are optional but recommended:
--repository: the id of the repository to run the indexing for, similar to project above. If the repository id is not specified, the repository settings override are required
--maxruntime: the amount of time in minutes the indexing can run before being shut down, default is 180 (3h)
--timeout: the amount of time in seconds any database operation can last before being terminated, default is 300 (5min)
--logfile: the path to output the log file, either absolute or relative with .\relativepath. When not provided logs are sent to %userprofile%\AppData\Roaming\MoQu\Logs
The following switches are required when a repository id is not provided, or to override the repository settings, they have the same meaning as the corresponding settings in the App > Configuration > Repositories > Settings, see Repository for more information.
--root
--filter
--area
--discipline
--stage
--revision
--version
--release
--milestone
--history
--allownocomponent
--ignorezero
--folderexlcusion
--ignorewireframe
--enforcefilefilters
--folderFilter
--inheritAttributes
As an example, the text below can be copied into a batch file to run indexing on the instance we configured during the Setup steps, using MoQu in Navisworks 2023, with 20min database timeout and 5h maximum index running time, outputing the log file in the batch folder:
"C:\ProgramData\Autodesk\ApplicationPlugins\MoQu.bundle\N23\MoQu.exe" --connection="server=.\dev;database=MoQuDemo;Trusted_Connection=True;Encrypt=False" --schema=BU1_MoQu --project=1 --repository=1 --timeout=1200 --maxruntime=300 --logfile=.\Index.Log --silent
Scheduling Overnight Indexing
MoQu doesn't currently have its own scheduling interface, however since all we can configure a batch file we can setup a Windows Scheduled Task to run our batch file every night.
Open the Task Scheduler (Win key, search for Schedule). In the Task Scheduler tree, right click Task Scheduler Library node and select Create Basic Task...
Give the task a Name of your choice (we recommend to use a combination of the App Name, Project Name and Repository, e.g. MoQu_MyProject_MyRepo)
Choose Daily trigger running at some time during the night.
Choose the action Start a Program and Browse to the location of the batch file. Leave only the batch file name in the Program/script fields, and put the directory name in the Start In field (this allows relative path for the log). the Arguments can be left blank
Click Finish.
The task Last Run Result at this point should be 0x41303 which means it never ran yet. We can wait for the scheduled execution, or force an immediate run by right clicking the task and clicking Run.
RUN WITHOUT LOGIN vs MFA |
|
|
For the task to run without a user, we can edit the task settings, under General select Run whether user is logged on or not. Clicking OK will prompt us for the password of the user session to open to run the task. Note that while this will allow the task to start without a user, Indexing from Sharepoint and/or to Azure likely requires OAuth login and possibly MFA confirmation by default, which will cause the task to stall and time out. Both platforms have login mechanisms to work around those restrictions, contact your administrator to get the appropriate credentials. |
Next
Component Info Process | All Processes