Script Repository


Enable or disable specific Web interface

December 08, 2021
108

The scripts enable or disable the specified Web interface.

Script 1: Adaxes scheduled task

To execute the script, create a scheduled task configured for the Domain-DNS object type and add a single managed domain to the Activity Scope of the task.

Parameters:

  • $webUIConfigurationName - Specifies the name of the Web interface to enable or disable.
  • $enabled - Specifies whether the Web interface will be enabled or disabled.
Edit Remove
PowerShell
$webUIConfigurationName = "HelpDesk" # TODO: modify me
$enabled = $false # TODO: modify me

# Get Web interface configuration
$webuiConfigPath = $Context.GetWellKnownContainerPath("WebUIConfigurationContainer")
$webuiConfigContainer = $Context.BindToObject($webuiConfigPath)
$webUIConfiguration = $webuiConfigContainer.GetConfiguration($webUIConfigurationName)

# Update configuration
$webUIConfiguration.Enabled = $enabled
$webUIConfiguration.SetInfo()

Script 2: external execution

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 to enable or disable.
  • $enabled - Specifies whether the Web interface will be enabled or disabled.
Edit Remove
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$webUIConfigurationName = "HelpDesk" # TODO: modify me
$enabled = $false # TODO: modify me

# Connect to the 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)

# Update configuration
$webUIConfiguration.Enabled = $enabled
$webUIConfiguration.SetInfo()

Comments ( 0 )
No results found.
Leave a comment