示例#1
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject.Identity,
                dataObject
            });
            ClientAccessServer clientAccessServer = new ClientAccessServer((Server)dataObject);

            if (this.IncludeAlternateServiceAccountCredentialPassword.ToBool())
            {
                SetClientAccessServer.EnsureRunningOnTargetServer(this, (Server)dataObject);
                clientAccessServer.AlternateServiceAccountConfiguration = AlternateServiceAccountConfiguration.LoadWithPasswordsFromRegistry();
            }
            else if (this.IncludeAlternateServiceAccountCredentialStatus.ToBool())
            {
                clientAccessServer.AlternateServiceAccountConfiguration = AlternateServiceAccountConfiguration.LoadFromRegistry(clientAccessServer.Fqdn);
            }
            IConfigurable[] array = this.ConfigurationSession.Find <ADRpcHttpVirtualDirectory>((ADObjectId)clientAccessServer.Identity, QueryScope.SubTree, null, null, 1);
            clientAccessServer.OutlookAnywhereEnabled = new bool?(array.Length > 0);
            QueryFilter filter = ExchangeScpObjects.AutodiscoverUrlKeyword.Filter;

            array = this.ConfigurationSession.Find <ADServiceConnectionPoint>((ADObjectId)clientAccessServer.Identity, QueryScope.SubTree, filter, null, 2);
            if (array.Length == 1)
            {
                ADServiceConnectionPoint adserviceConnectionPoint = array[0] as ADServiceConnectionPoint;
                if (adserviceConnectionPoint.ServiceBindingInformation.Count > 0)
                {
                    clientAccessServer.AutoDiscoverServiceInternalUri = new Uri(adserviceConnectionPoint.ServiceBindingInformation[0]);
                }
                clientAccessServer.AutoDiscoverServiceGuid      = new Guid?(GetClientAccessServer.ScpUrlGuid);
                clientAccessServer.AutoDiscoverServiceCN        = Fqdn.Parse(adserviceConnectionPoint.ServiceDnsName);
                clientAccessServer.AutoDiscoverServiceClassName = adserviceConnectionPoint.ServiceClassName;
                if (adserviceConnectionPoint.Keywords != null && adserviceConnectionPoint.Keywords.Count > 1)
                {
                    MultiValuedProperty <string> multiValuedProperty = null;
                    foreach (string text in adserviceConnectionPoint.Keywords)
                    {
                        if (text.StartsWith("site=", StringComparison.OrdinalIgnoreCase))
                        {
                            if (multiValuedProperty == null)
                            {
                                multiValuedProperty = new MultiValuedProperty <string>();
                            }
                            multiValuedProperty.Add(text.Substring(5));
                        }
                    }
                    if (multiValuedProperty != null && multiValuedProperty.Count > 0)
                    {
                        clientAccessServer.AutoDiscoverSiteScope = multiValuedProperty;
                    }
                }
            }
            base.WriteResult(clientAccessServer);
            TaskLogger.LogExit();
        }
示例#2
0
        protected override IConfigurable PrepareDataObject()
        {
            Server server = (Server)base.PrepareDataObject();

            if (base.ParameterSetName == "AlternateServiceAccount")
            {
                if (this.NeedAlternateServiceAccountPasswords)
                {
                    SetClientAccessServer.EnsureRunningOnTargetServer(this, server);
                    this.alternateServiceAccountConfiguration = AlternateServiceAccountConfiguration.LoadWithPasswordsFromRegistry();
                }
                else
                {
                    this.alternateServiceAccountConfiguration = AlternateServiceAccountConfiguration.LoadFromRegistry(server.Fqdn);
                }
            }
            return(server);
        }