LibreOffice tool can be used to convert MSOffice documents to pdf file.

My team noticed that our system seems failed to convert the documents randomly after we are trying to run the process in parallel.

Digging up the internet, I found that it is a common issue,

Fortunately there is a simple solution to that, by simply passing an additional parameter, to specify a different installation folder.

lowriter -env:UserInstallation=file://$random_dir --convert-to pdf --outdir $output_dir $input_file

I am adding -env:UserInstallation parameter additionally from our existing command. The random folder as the name implied is a random string with absolute path, and the folder will be created automatically and do not need to be created beforehand.