Is there a way to set preferences for our users at deployment?
I know how to set all these settings via the GUI but doing them for every PC we build manually kind of defeats the purpose of our deployment tooling.
I know of two ways to do that:
- Preconfigure a
registrymodifications.xcu
settings file in theAllUsers
directory. This should be taken into account when creating any new account on the PC. - Create and install a dedicated extension that actually sets all the wanted options. This will set that configuration under any account. See here for more information: https://wiki.documentfoundation.org/images/b/b0/LibreOffice_config_extension_writing.pdf
yeah thanks…
i was considering #1 initially, but often our users are already created when we install LO
then I found out about #2 while searching a bit deeper
I think I’ve created a correct .OXT file and I’m testing it out now
thanks, I’ve read that…
I’m looking for some more information
for instance the wiki only has 2 of the 25000 registry keys that can be configured
but i can’t find any information on the other 24998
Can you list which preferences you are trying to set?
The information about these 24998 is in the PDF mentioned above by @jfn, in its “Step 1: Identifying the configuration parameter”.
that PDF doesn’t have any information about registry keys, only how to create a config extension
i was able to create one, but was not able to get it to work properly
it worked once, and then never worked again
… but it shows how to find a key (any key) of interest.
not really… it shows you how to get the .xcu xml entry for a setting but not the registry key
what registry keys to i use to set these options?
<oor:component-data oor:name="Common" oor:package="org.openoffice.Office"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<node oor:name="Save">
<node oor:name="Document">
<prop oor:name="WarnAlienFormat" oor:type="xs:boolean">
<value>false</value>
</prop>
</node>
</node>
</oor:component-data>
<oor:component-data
oor:name="Setup"
oor:package="org.openoffice"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="Office">
<node oor:name="Factories">
<node oor:name="org.openoffice.Setup:Factory['com.sun.star.sheet.SpreadsheetDocument']">
<prop oor:name="ooSetupFactoryDefaultFilter" oor:type="xs:string">
<value>Calc MS Excel 2007 XML</value>
</prop>
</node>
<node oor:name="org.openoffice.Setup:Factory['com.sun.star.text.TextDocument']">
<prop oor:name="ooSetupFactoryDefaultFilter" oor:type="xs:string">
<value>Office Open XML Text</value>
</prop>
</node>
</node>
</node>
</oor:component-data>
Ah - by “registry key”, do you mean “Windows Registry”, or “LibreOffice registry”?
The Windows Registry keys (used by GPO) correspond to the XML structure.
I ended up creating a registrymodifications.xcu and copying it to the “Default” user appdata folder and also to any other users (but not the other special system users)
$source = '\\SPB701\Repository$\LibreOffice\registrymodifications.xcu'
if (-not (Test-Path $source)) {
Write-Output "ERROR: Source file does not exist: $source"
Write-Output "Aborting script."
exit 1
}
$usersPath = 'C:\Users'
$userDirs = Get-ChildItem $usersPath -Directory -Force | Where-Object {
$_.Name -notin @('Public', 'lckbox', 'Admin', 'pbkbox', 'lapdq', 'lakbox', 'Default User', 'All Users') -and
-not ($_.Name.StartsWith('$'))
}
foreach ($user in $userDirs) {
$destDir = "$($user.FullName)\AppData\Roaming\LibreOffice\4\user"
$destFile = Join-Path $destDir 'registrymodifications.xcu'
Write-Output "----"
Write-Output "Processing user: $($user.Name)"
Write-Output "Target directory: $destDir"
# Create the folder if it doesn't exist
if (-not (Test-Path $destDir)) {
Write-Output "Target directory does not exist. Creating..."
New-Item -Path $destDir -ItemType Directory -Force | Out-Null
} else {
Write-Output "Target directory exists."
}
# Backup existing file
if (Test-Path $destFile) {
# Use a timestamp (date and time down to seconds to avoid collisions)
$timestamp = Get-Date -Format "yyyy-MM-dd_HHmmss"
$backupFile = "$destFile.bak-$timestamp"
Write-Output "Existing registrymodifications.xcu found. Backing up to $backupFile"
Copy-Item $destFile $backupFile -Force
} else {
Write-Output "No existing registrymodifications.xcu found. No backup needed."
}
# Copy the file
Write-Output "Copying $source to $destFile"
Copy-Item $source $destFile -Force
Write-Output "Done."
}
Write-Output "----"
Write-Output "All users processed."
The Windows Registry keys (used by GPO) correspond to the XML structure.
yeah i kind of figured that out from reading the Collabora ADMX templates source on github
but it just wasn’t working right… i could get docx for text files but not xlsx for spreadsheets
i ended up copying the .xcu file
Your issue could be similar to what was fixed in Fix default template keys · CollaboraOnline/ADMX@c0b9703 · GitHub (but I didn’t check).
Note that you can always use tools like Sysinternals Procmon to monitor which registry keys are read by LibreOffice on startup.