LabHQ Results Import Agent
Note: This documentation is intended for IT administrators or technically proficient users responsible for managing integrations and automated workflows. It is not aimed at general LabHQ users.
The LabHQ Results Import Agent is a lightweight client-side application that monitors your local file system and automatically uploads result files to the LabHQ system.
The LabHQ Results Importer automates the process of uploading CSV files. To ensure the importer works correctly, your LabHQ system must be configured to recognize the structure of your CSV files. See Importing Results for more details on how to configure your LabHQ system for result imports.
System Requirements
- Windows operating system
- PowerShell 7.x (download and installation instructions are available here)
Installation & Setup
- Install Powershell 7
- Download and installation instructions are available here.
- Download the Import Agent
- Download the latest version of the LabHQ Results Import Agent here.
- Extract
upload-results.zipto a folder of your choice.
Configuration
Inside the extracted folder, locate the config.json file. Update the following values:
watchFolder
This is the path to the folder where the agent should look for CSV files.
Backslashes must be escaped, e.g:
C:\\WatchedFiles\\Subfolder- Alternatively you can use forward slashes:
C:/WatchedFiles/Subfolder
mapping
This should be the name of the equipment item corresponding to the CSV files.
apiKey
This will be your API key as requested from Broughton Software.
Other Settings
You can change the configuration setting values if you're given a different URL from Broughton Software, or if you want to change how log rotation works.
If intervalMinutes setting is changed, you must reinstall the scheduled task for the update to take effect.
Installing the Agent
Run install-script-as-task.ps1
You will be prompted to elevate to an Administrator if not one already.
This creates a Scheduled Task that runs the agent every 30 minutes by default.
After installation, the agent is available at:
C:\ProgramData\Broughton Software\.
This folder contains:
upload-results.ps1- The main import script that processes files and uploads them to LabHQ.
config.json- A live configuration file. You may edit this at any time.
- Logs folder
- Contains logs for successful and failed uploads.
last-check.txt- Stores the timestamp of the last successful run.
- Only files created after this timestamp are uploaded
- Deleting this file forces the agent to re-upload all files in the watch folder on the next run.
- Stores the timestamp of the last successful run.
Removing the Agent
To completely remove the import agent's Schedule Task:
- Run
remove-script-as-task.ps1.
This will unregister the task from Windows Task Scheduler.
Running the Task Manually
If you wish to run the task manually, follow the steps below:
- Open Task Scheduler.
- Locate the installed LabHQ import task.
- Right-click and select Re-run Task.
If the task fails or you need more detailed output, open the Command Prompt as Administrator, and run:
pwsh.exe -NoProfile -ExecutionPolicy Bypass -File "C:\ProgramData\Broughton Software\upload-results.ps1"
This should display any error messages for debugging the problem.
Obtaining a LabHQ Developer API Key
To use the LabHQ Results Importer, you need a Developer API Key. You can request an API key by contacting Broughton Software Support.
FAQ
Is CSV the only supported file format?
Yes. At present, the Results Import Agent supports CSV files only. However, support for additional file formats may be introduced in the future based on customer needs. If you require another format, please contact Broughton Software Support.
How often does the agent check for new files?
By default, the agent checks the watch folder every 30 minutes. You can change this interval by modifying the intervalMinutes value in config.json. If you change it, you must rerun install-script-as-task.ps1 to update the Scheduled Task.
Does the agent upload files that have already been uploaded?
No. The agent tracks the last successful run using the last-check.txt file. Only files created after this timestamp are uploaded. If you delete last-check.txt, the next run will upload all files in the watch folder.
What happens if a file fails to upload?
Any errors are logged in the logs folder.
Failed files are retried during the next run (as long as their timestamps still qualify). Failed uploads do not stop or interrupt the importer.
Will the agent delete or modify my files?
No. The agent is read-only.
It never deletes, moves, overwrites, or alters files in the watched folder.