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

Create new Web interface configuration with specific settings

February 25, 2021 Views: 1337

The script creates a new Web interface configuration with specific settings based on the specified existing configuration. 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:

  • $sourceConfigurationName - Specifies the name of Adaxes Web interface configuration from which to copy settings for the new Web interface.
  • $newConfigurationName - Specifies the name of the new Web interface configuration.
  • $defaultDomain - Specifies the domain that will be used for domainless logins.
  • $groupDN - Specifies the distinguished name (DN) of the group whose members will be allowed to access the new Web interface.
  • $footerHTML - Specifies the HTML footer that will be set for the new Web interface.
  • $helpLinkText - Specifies the text that will be displayed for the Help link in the new Web interface.
  • $helpLinkHintText - Specifies the text of the Hint that will be displayed for the Help link in the new Web interface.
  • $helpLinkUrl - Specifies the URL for the Help link in the new Web interface.
  • $supportLinkText - Specifies the text that will be displayed for the Support link in the new Web interface.
  • $supportLinkHintText - Specifies the text of the Hint that will be displayed for the Support link in the new Web interface.
  • $supportLinkUrl - Specifies the URL for the Support link in the new Web interface.
Edit Remove
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$sourceConfigurationName = "Admin" # TODO: modify me
$newConfigurationName = "MySite" # TODO: modify me
$defaultDomain = "MyDomain.com" # TODO: modify me
$groupDN = "CN=MyGroup,OU=Groups,DC=domain,DC=com" # TODO: modify me
$footerHTML = "<b>My Footer</b>" # TODO: modify me
$helpLinkText = "Help" # TODO: modify me
$helpLinkHintText = "Help" # TODO: modify me
$helpLinkUrl = "http://HelpSite.local" # TODO: modify me
$supportLinkText = "Support" # TODO: modify me
$supportLinkHintText = "Support" # TODO: modify me
$supportLinkUrl = "http://SupportSite.local" # TODO: modify me

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

# Bind to the 'WebUI Configuration' container
$webuiConfigContainerPath = $admService.Backend.GetConfigurationContainerPath("WebUIConfigurationContainer")
$credentials = Get-Credential
$webuiConfigContainer = $admService.OpenObject($webuiConfigContainerPath, $credentials.Username, $credentials.GetNetworkCredential().Password, 0)

# Create new Web Interface
$sourceConfiguration = $webuiConfigContainer.GetConfiguration($sourceConfigurationName)
$newConfiguration = $webuiConfigContainer.CopyHere($sourceConfiguration.AdsPath, "CN=$newConfigurationName")

# Remove priority
$newConfiguration.PropertyList.ResetPropertyItem("adm-Priority")

# Generate new WebUITypeID
$newConfiguration.Put("adm-WebUITypeID", [Guid]::NewGuid().ToByteArray())

# Copy InitialBuiltInConfigurationId
if ($sourceConfiguration.InitialBuiltInConfigurationId)
{
    $newConfiguration.InitialBuiltInConfigurationId = $sourceConfiguration.InitialBuiltInConfigurationId
}

# Enable Domainless Username
$newConfiguration.SignInUseCommonSettingsEnabled = $False
$signInUsernameSettings = $newConfiguration.SignInUsernameSettings
$signInUsernameSettings.DefaultDomainEnabled = $True
$signInUsernameSettings.DefaultDomain = $defaultDomain
$newConfiguration.SignInUsernameSettings = $signInUsernameSettings

# Set Access Control
$accessControlForUsers = $newConfiguration.AccessControlForUsers
$accessControlForUsers.AccessControlType = "ADM_WEBUI_ACCESSCONTROLTYPE_ALLOWSPECIFIC"
$objReference = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$objReference.ObjectDN = $groupDN
$accessControlForUsers.AllowedSpecificItems = @($objReference)
$newConfiguration.AccessControlForUsers = $accessControlForUsers

# Set Footer
$pageFooterSettings = $newConfiguration.PageFooterSettings
$pageFooterSettings.CustomFooterEnabled = $True
$pageFooterSettings.CustomFooterHtml = $footerHTML
$newConfiguration.PageFooterSettings = $pageFooterSettings

# Set Help links
$helpSupportLinkSettings = $newConfiguration.HelpSupportLinkSettings
$helpLink = $helpSupportLinkSettings.HelpLink
$helpLink.DisplayEnabled = $True
$helpLink.Text = $helpLinkText
$helpLink.HintText = $helpLinkHintText
$helpLink.Url = $helpLinkUrl

# Set Support links
$supportLink = $helpSupportLinkSettings.SupportLink
$supportLink.DisplayEnabled = $True
$supportLink.Text = $supportLinkText
$supportLink.HintText = $supportLinkHintText
$supportLink.Url = $supportLinkUrl
$newConfiguration.HelpSupportLinkSettings = $helpSupportLinkSettings

# Save the changes
try
{
    $newConfiguration.SetInfo()
}
catch
{
    throw
}
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers