Script repository
The script creates a new web interface with certain 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- the name of Adaxes web interface to copy settings for the new web interface from.$newConfigurationName- the name of the new web interface.$defaultDomain- the domain that will be used for domainless logins.$groupDN- the distinguished name (DN) of the group whose members will be allowed to access the new web interface. For information on how to get the DN, see Get the DN of a directory object.$footerHTML- the HTML footer that will be set for the new web interface.$helpLinkText- the text that will be displayed for the Help link in the new web interface.$helpLinkHintText- the text of the hint that will be displayed for the Help link in the new web interface.$helpLinkUrl- the URL for the Help link in the new web interface.$supportLinkText- the text that will be displayed for the Support link in the new web interface.$supportLinkHintText- the text of the hint that will be displayed for the Support link in the new web interface.$supportLinkUrl- the URL for the Support link in the new web interface.
Import-Module Adaxes
$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
You must be signed in to comment.