Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Sample: Configure Web Address Settings (PowerShell)

[Applies to: Microsoft Dynamics CRM 2011]

This sample code is for Microsoft Dynamics CRM 2011, and can be found in the following location in the SDK download:

SampleCode\PS1\ConfigureWebAddressSettings.ps1

Requirements

To set up the Microsoft Dynamics CRM PowerShell cmdlets, see Use PowerShell to Call the Deployment Web Service.

Demonstrates

The following script will configure Web address settings - partner-hosted (IFD). You must specify the following parameters:

RootDomainScheme – The root domain scheme: http or https. .

DeploymentSdkRootDomain – The root domain for the deployment Web service (SDK).

DiscoveryRootDomain – The root domain for the discovery Web service.

NlbEnabled – A Boolean that specifies whether network load balancing (NLB) is enabled.

SdkRootDomain – The root domain for the organization Web service (SDK).

SslHeader – The secured sockets layer (SSL) header.

WebAppRootDomain – The root domain for the Web application.

Example

param
(
    #optional params
    [string]$RootDomainScheme,
    [string]$DeploymentSdkRootDomain,
    [string]$DiscoveryRootDomain,
    [boolean]$NlbEnabled,
    [string]$SdkRootDomain,
    [string]$SslHeader,
    [string]$WebAppRootDomain
)

$RemoveSnapInWhenDone = $False

if (-not (Get-PSSnapin -Name Microsoft.Crm.PowerShell -ErrorAction SilentlyContinue))
{
    Add-PSSnapin Microsoft.Crm.PowerShell
    $RemoveSnapInWhenDone = $True
}

$WebAddressSettings = Get-CrmSetting -SettingType WebAddressSettings

if($DeploymentSdkRootDomain) {$WebAddressSettings.DeploymentSdkRootDomain = $DeploymentSdkRootDomain}
if($DiscoveryRootDomain) {$WebAddressSettings.DiscoveryRootDomain = $DiscoveryRootDomain}
if($PSBoundParameters.ContainsKey('NlbEnabled')) {$WebAddressSettings.NlbEnabled = $NlbEnabled}
if($RootDomainScheme) {$WebAddressSettings.RootDomainScheme = $RootDomainScheme}
if($SdkRootDomain) {$WebAddressSettings.SdkRootDomain = $SdkRootDomain}
if($PSBoundParameters.ContainsKey('SslHeader')) {$WebAddressSettings.SslHeader = $SslHeader}
if($WebAppRootDomain) {$WebAddressSettings.WebAppRootDomain = $WebAppRootDomain}

Set-CrmSetting -Setting $WebAddressSettings

$WebAddressSettings

if($RemoveSnapInWhenDone)
{
    Remove-PSSnapin Microsoft.Crm.PowerShell
}

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.