The script copies the changes made to UI texts from one separate Adaxes configuration to another. If a string was not modified for a language, it will not be copied.
Execute the script in Windows PowerShell on the computer where Adaxes service from which the settings will be copied is installed. When prompted, first specify the credentials of the source instance Adaxes service account (specified during Adaxes installation) and then those of the target instance.
Parameters:
- $adaxesServiceSourceName - Specifies the host name of the Adaxes service from which the changes will be copied.
- $adaxesServiceTargetName - Specifies the host name of the Adaxes service to which the changes will be copied.
- $sourceWebUIName - Specifies the name of the Adaxes Web interface from which the changes will be copied.
- $tragetWebUIName - Specifies the name of the Adaxes Web interface to which the changes will be copied.
- $languagesToCopy - Specifies two letter codes (e.g. de for German) of languages for which the changes should be copied. To copy the changes for all languages, set the variable to an empty array.
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$adaxesServiceSourceName = "AdaxesServiceSource.example.com" # TODO: modify me
$adaxesServiceTargetName = "AdaxesServiceTarget.example.com" # TODO: modify me
$sourceWebUIName = "SourceWebUI" # TODO: modify me
$tragetWebUIName = "TargetWebUI" # TODO: modify me
$languagesToCopy = @("ar", "se") # TODO: modify me
# Get credentails
$adaxesServiceSourceCred = Get-Credential -Message "Enter credentials for $adaxesServiceSourceName Adaxes service"
$adaxesServiceTargetCred = Get-Credential -Message "Enter credentials for $adaxesServiceTargetName Adaxes service"
# Get languages from source service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly($adaxesServiceSourceName)
$webuiConfigPath = $admService.Backend.GetConfigurationContainerPath("WebUIConfigurationContainer")
$webuiConfigContainer = $admService.OpenObject($webuiConfigPath, $adaxesServiceSourceCred.UserName, $adaxesServiceSourceCred.GetNetworkCredential().Password, 0)
$sourceWebuiConfig = $webuiConfigContainer.GetConfig($sourceWebUIName)
$translationsJson = $sourceWebuiConfig.ToJson('{elements: ["translations"]}')
# Bind to target Web Interface
$admService = $admNS.GetServiceDirectly($adaxesServiceTargetName)
$webuiConfigPath = $admService.Backend.GetConfigurationContainerPath("WebUIConfigurationContainer")
$webuiConfigContainer = $admService.OpenObject($webuiConfigPath, $adaxesServiceTargetCred.UserName, $adaxesServiceTargetCred.GetNetworkCredential().Password, 0)
$targetWebuiConfig = $webuiConfigContainer.GetConfig($tragetWebUIName)
# Set languages to target service
if ($languagesToCopy.Length -eq 0)
{
$targetWebuiConfig.FromJson($null, $translationsJson)
}
else
{
$translationsToUpdate = @()
$translations = $translationsJson | ConvertFrom-Json
foreach ($translation in $translations.Translations)
{
if ($languagesToCopy -notcontains $translation.Language)
{
continue
}
$translationsToUpdate += $translation
}
if ($translationsToUpdate.Length -eq 0)
{
return
}
$translations.translations = $translationsToUpdate
$translationsJson = $translations | ConvertTo-Json -Depth 4
$targetWebuiConfig.FromJson($null, $translationsJson)
}