Topic Last Modified: 2012-04-23

Modifies an existing collection of Autodiscover configuration settings. The Autodiscover service provides a way for client applications such as Lync Web Access or Microsoft Lync Mobile to locate key resources such as a user's home pool or the URL for joining a dial-in conference.

Set-CsAutodiscoverConfiguration [-Identity <XdsIdentity>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-WebLinks <PSListModifier>] [-WhatIf [<SwitchParameter>]]
Set-CsAutodiscoverConfiguration [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-Instance <PSObject>] [-WebLinks <PSListModifier>] [-WhatIf [<SwitchParameter>]]

For client applications to make the most effective use of Microsoft Lync Server 2010 those applications need to know the location of key Lync Server 2010 components. For example, authenticated users must be able to locate their home pool; after all, they can only be authenticated by that home pool. Likewise, unauthenticated users must be able to do such things as locate the URL used for joining a conference.

If all your users logged on from behind the organization's firewall discovering these locations would be a relatively simple task. However, this relatively simple task gets more and more complicated as users access the system from external locations using Microsoft Lync Mobile or Lync Web Access.

This is especially true in split-domain scenarios, scenarios in which some of an organization's users have accounts on the on-premises version of Lync Server while other users have accounts on Microsoft Office 365. In cases such as this, user accounts might be located in different Active Directory forests. That can pose a problem: for example, if a US-based user logs on from Europe the system must be able to recognize his or her forest and then refer the logon request to the proper pool.

The Autodiscover service was introduced in the November 2011 release of Lync Server in order to address these issues. When a client application attempts to access Lync Server, the Autodiscover service parses the client SIP address and then redirects that request to the appropriate pool. Client applications connect to the Autodiscover service by sending an HTTP request to an Autodiscover URL; these URLs must be configured by administrators in order for the Autodiscover service to work. (Note that, in addition to configuring URLs, administrators must also create DNS records that correspond to these URLs.)

Autodiscover URLs are assigned to Autodiscover configuration settings; in turn, these settings can be applied to the global scope or to the site scope. When you install Lync Server a global collection of settings will be created for you. (However, no Autodiscover URLs will be assigned to that collection.) If a single collection of Autodiscover settings will not fill your needs, then you can use the New-CsAutoDiscoverConfiguration cmdlet to create additional configuration settings at the site scope. From there, you can use the Set-CsAutoDiscoverConfiguration cmdlet to add or remove Autodiscover URLs from the global collection or from any site-scoped collection.

Who can run this cmdlet: By default, members of the following groups are authorized to run the Set-CsAutoDiscoverConfiguration cmdlet locally: RTCUniversalServerAdmins.


Parameter Required Type Description



XDS Identity

Unique identifier for the collection of Autodiscover configuration settings to be modified. To modify to the global collection, use this syntax:

-Identity "global"

To modify a collection configured at the site scope, use syntax similar to this:

-Identity "site:Redmond"

If this parameter is not specified, then Set-CsAutoDiscoverConfiguration will automatically modify the global settings.



AutoDiscoverConfiguration object

Allows you to pass a reference to an object to the cmdlet rather than set individual parameter values.



PS List Modifier

Collection of Autodiscover URLs. These URLs must be created by using the New-CsWebLink cmdlet.



Switch Parameter

Suppresses the display of any non-fatal error message that might occur when running the command.

Set-CsAutoDiscoverConfiguration accepts pipelined input of the Microsoft.Rtc.Management.WriteableConfig.Settings.AutoDiscoverConfiguration.AutoDiscoverConfiguration object.

None. Set-CsAutoDiscoverConfiguration modifies instances of the Microsoft.Rtc.Management.WriteableConfig.Settings.AutoDiscoverConfiguration.AutoDiscoverConfiguration object.

-------------------------- Example 1 --------------------------

$Link1 = New-CsWebLink -Token "Fabrikam" -Href ""

Set-CsAutoDiscoverConfiguration -Identity "site:Redmond" -WebLinks @{Add=$Link1}

The commands shown in Example 1 add a new Autodiscover URL ( to the Autodiscover configuration settings assigned to the Redmond site. To do this, the first command in the example uses the New-CsWebLink cmdlet to create a new Autodiscover URL; that URL is stored in a variable named $Link1. In the second command, Set-CsAutoDiscoverConfiguration is used to add the new URL to any URLs already assigned to these settings. This is done by using the WebLinks parameter and the parameter value @{Add=$Link1}.

-------------------------- Example 2 --------------------------

$Link1 = Get-CsAutoDiscoverConfiguration  -Identity "site:Redmond" | Select-Object -ExpandProperty WebLinks | Where-Object {$_.Token -eq "Fabrikam"}

Set-CsAutoDiscoverConfiguration -Identity "site:Redmond" -WebLinks @{Remove=$Link1}

The preceding commands demonstrate how you can remove a URL from a collection of Autodiscover configuration settings. In order to do this, the first command in the collection retrieves an object reference to the URL to be deleted (a URL that has a Token equal to "Fabrikam"). This is done by first calling the Get-CsAutoDiscoverConfiguration cmdlet in order to retrieve the Autodiscover settings for the Redmond site. That collection in then piped to the Select-Object cmdlet, which uses the ExpandProperty parameter to "expand" the WebLinks property. (When a property is expanded, that provides Get-CsAutoDiscoverConfiguration access to the individual objects stored in that property.) These WebLinks objects are then piped to the Where-Object cmdlet, which selects the one object where the Token property is equal to "Fabrikam". That WebLinks object is then stored in a variable named $Link1.

After that the second command in the example uses Set-CsAutoDiscoverConfiguration to remove the object stored in $Link1. To do this, the command uses the WebLinks parameter and the parameter value @{Remove=$Link1}.

-------------------------- Example 3 --------------------------

$Link2 = New-CsWebLink -Token "Contoso" -Href ""

Set-CsAutoDiscoverConfiguration -Identity "site:Redmond" -WebLinks @{Replace=$Link2}

Example 3 shows how you can replace an existing collection of Autodiscover URLs with, in this case, a single URL. To carry out this task, the first command in the example uses the New-CsWebLink cmdlet to create a new Autodiscover URL for; the resulting URL is stored in a variable named $Link2. The second command then uses Set-CsAutoDiscoverConfiguration and the WebLinks parameter to remove any URLs previously assigned to the Redmond site and replace them with the URL for To do this, the command uses the Replace method instead of the Add or Remove method.

-------------------------- Example 4 --------------------------

Set-CsAutoDiscoverConfiguration -Identity "site:Redmond" -WebLinks $Null

The command shown in Example 4 removes all the Autodiscover URLs that have been assigned to the Redmond site. To do this, the command sets the WebLinks property to a null value; in turn, that deletes any URLs previously assigned to that property.