We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script repository

Enable or disable specific Web interface

December 08, 2021 Views: 566

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
Leave a comment
Loading...

Got questions?

Support Questions & Answers