Script Repository


January 09, 2019
277

The script updates the list of object types available for Advanced Search in Adaxes Web Interface. Execute the script in Windows PowerShell on the computer where Adaxes service is installed. When prompted, specify the credentials of the Adaxes service account (specified during Adaxes installation).

Parameters:

  • $webUIConfigurationName - specifies the name of the Web Interface configuration of which will be updated;
  • $objectTypes - specifies an array of object types that will be added to the Advanced Search configuration;
  • $displayName - specifies the display name for the object types specified in $objectTypes;
  • $searchByDefault - specifies whether searching the object types will be enabled by default.
  • $visible - specifies whether the new entry will be visible when performing Advanced Search in the Web Interface.
Edit Remove
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$webUIConfigurationName = "HelpDesk" # TODO: modify me
$objectTypes = @("volume") # TODO: modify me
$displayName = "Shared folders" # TODO: modify me
$searchByDefault = $True # TODO: modify me
$visible = $True # TODO: modify me

# Bind to Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Get Web Interface configuration
$webuiConfigPath = $admService.Backend.GetConfigurationContainerPath(
    "WebUIConfigurationContainer")

$credential = Get-Credential
$webuiConfigContainer = $admService.OpenObject($webuiConfigPath, $credential.UserName, $credential.GetNetworkCredential().Password, 0)
$webUIConfiguration = $webuiConfigContainer.GetConfiguration($webUIConfigurationName)

$searchSettings = $webUIConfiguration.SearchSettings
$advancedSearchObjectTypes = $searchSettings.AdvancedSearchObjectTypes
foreach ($objectType in $advancedSearchObjectTypes)
{
    if (@(Compare-Object $objectType.DirectoryObjectTypes $objectTypes).Length -eq 0)
    {
        $message = "Object types array specified for: " + $objectType.DisplayName
        Write-Warning $message
        return
    }
}

# Add object type to Advanced Search
$searchObjectType = New-Object Softerra.Adaxes.Management.WebUI.Search.AdmWebUISearchObjectType
$searchObjectType.DirectoryObjectTypes = $objectTypes
$searchObjectType.DisplayName = $displayName
$searchObjectType.SearchByDefault = $searchByDefault
$searchObjectType.Visible = $visible

$advancedSearchObjectTypes += $searchObjectType
$searchSettings.AdvancedSearchObjectTypes = $advancedSearchObjectTypes
$webUIConfiguration.SearchSettings = $searchSettings

# Save the changes
$webUIConfiguration.SetInfo()

Comments ( 0 )
No results found.
Leave a comment