示例#1
0
        public IFederationInformation GetFederationInformation(string domainName)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("DomainName", domainName);
            sessionParameters.Set("BypassAdditionalDomainValidation", true);
            Dictionary <string, object> dictionary = null;

            try
            {
                dictionary = this.RemotePowershellSession.GetPowershellUntypedObjectAsMembers("Get-FederationInformation", null, sessionParameters);
            }
            catch
            {
            }
            if (dictionary != null)
            {
                FederationInformation federationInformation = new FederationInformation();
                object value;
                if (dictionary.TryGetValue("TargetAutodiscoverEpr", out value))
                {
                    federationInformation.TargetAutodiscoverEpr = TaskCommon.ToStringOrNull(value);
                }
                if (dictionary.TryGetValue("TargetApplicationUri", out value))
                {
                    federationInformation.TargetApplicationUri = TaskCommon.ToStringOrNull(value);
                }
                return(federationInformation);
            }
            return(null);
        }
示例#2
0
        public void RemoveRemoteDomain(ObjectId identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Confirm", false);
            sessionParameters.Set("Identity", identity.ToString());
            this.RemotePowershellSession.RunOneCommand("Remove-RemoteDomain", sessionParameters, false);
        }
示例#3
0
        public void RemoveAvailabilityAddressSpace(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.Set("Confirm", false);
            base.RemotePowershellSession.RunOneCommand("Remove-AvailabilityAddressSpace", sessionParameters, false);
        }
示例#4
0
        public void RemoveIntraOrganizationConnector(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.Set("Confirm", false);
            base.RemotePowershellSession.RunOneCommand("Remove-IntraOrganizationConnector", sessionParameters, false);
        }
示例#5
0
        public void UpdateEmailAddressPolicy(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.Set("UpdateSecondaryAddressesOnly", true);
            base.RemotePowershellSession.RunOneCommand("Update-EmailAddressPolicy", sessionParameters, false);
        }
示例#6
0
        public void SetWebServicesVirtualDirectory(string distinguishedName, bool proxyEnabled)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", distinguishedName);
            sessionParameters.Set("MRSProxyEnabled", proxyEnabled);
            base.RemotePowershellSession.RunCommand("Set-WebServicesVirtualDirectory", sessionParameters);
        }
示例#7
0
        public DomainContentConfig NewRemoteDomain(string domainName, string name)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Name", name);
            sessionParameters.Set("DomainName", domainName);
            return(base.RemotePowershellSession.RunOneCommandSingleResult <DomainContentConfig>("New-RemoteDomain", sessionParameters, false));
        }
示例#8
0
        public void RemoveOutboundConnector(ADObjectId identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity.ToString());
            sessionParameters.Set("Confirm", false);
            base.RemotePowershellSession.RunOneCommand("Remove-OutboundConnector", sessionParameters, false);
        }
示例#9
0
        public void SetFederatedOrganizationIdentifier(string defaultDomain)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("DefaultDomain", defaultDomain);
            sessionParameters.Set("Enabled", true);
            base.RemotePowershellSession.RunOneCommand("Set-FederatedOrganizationIdentifier", sessionParameters, false);
        }
示例#10
0
        public void NewAcceptedDomain(string domainName, string name)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("DomainName", domainName);
            sessionParameters.Set("Name", name);
            base.RemotePowershellSession.RunCommand("New-AcceptedDomain", sessionParameters);
        }
示例#11
0
        public void RemoveOrganizationRelationship(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.Set("Confirm", false);
            this.RemotePowershellSession.RunCommand("Remove-OrganizationRelationship", sessionParameters);
        }
示例#12
0
        public void SetIntraOrganizationConnector(string identity, string discoveryEndpoint, MultiValuedProperty <SmtpDomain> targetAddressDomains, bool enabled)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.Set("DiscoveryEndpoint", discoveryEndpoint);
            sessionParameters.Set <SmtpDomain>("TargetAddressDomains", targetAddressDomains);
            sessionParameters.Set("Enabled", enabled);
            base.RemotePowershellSession.RunOneCommand("Set-IntraOrganizationConnector", sessionParameters, false);
        }
示例#13
0
        public void AddAvailabilityAddressSpace(string forestName, AvailabilityAccessMethod accessMethod, bool useServiceAccount, Uri proxyUrl)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("ForestName", forestName);
            sessionParameters.Set("AccessMethod", accessMethod);
            sessionParameters.Set("UseServiceAccount", useServiceAccount);
            sessionParameters.Set("ProxyUrl", proxyUrl);
            base.RemotePowershellSession.RunOneCommand("Add-AvailabilityAddressSpace", sessionParameters, false);
        }
示例#14
0
        public void SetFederatedOrganizationIdentifier(string accountNamespace, string delegationTrustLink, string defaultDomain)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("AccountNamespace", accountNamespace);
            sessionParameters.Set("DelegationFederationTrust", delegationTrustLink);
            sessionParameters.Set("Enabled", true);
            sessionParameters.Set("DefaultDomain", defaultDomain);
            base.RemotePowershellSession.RunOneCommand("Set-FederatedOrganizationIdentifier", sessionParameters, false);
        }
示例#15
0
 private void ConfigureOnPremisesRemoteDomains()
 {
     foreach (KeyValuePair <string, Tuple <MailFlowTask.RemoteDomainType, MailFlowTask.Operation, DomainContentConfig> > keyValuePair in this.onpremisesRemoteDomains)
     {
         string key = keyValuePair.Key;
         MailFlowTask.RemoteDomainType item  = keyValuePair.Value.Item1;
         MailFlowTask.Operation        item2 = keyValuePair.Value.Item2;
         DomainContentConfig           domainContentConfig = keyValuePair.Value.Item3;
         if (item2 == MailFlowTask.Operation.New)
         {
             string name = string.Format("Hybrid Domain - {0}", key);
             domainContentConfig = base.OnPremisesSession.NewRemoteDomain(key, name);
         }
         if (item2 == MailFlowTask.Operation.New || item2 == MailFlowTask.Operation.Update)
         {
             SessionParameters sessionParameters = new SessionParameters();
             if (item == MailFlowTask.RemoteDomainType.HybridDomain)
             {
                 sessionParameters.Set("TrustedMailInbound", true);
             }
             else if (item == MailFlowTask.RemoteDomainType.Coexistence)
             {
                 sessionParameters.Set("AllowedOOFType", AllowedOOFType.InternalLegacy);
                 sessionParameters.Set("TrustedMailOutbound", true);
                 sessionParameters.Set("AutoReplyEnabled", true);
                 sessionParameters.Set("AutoForwardEnabled", true);
                 sessionParameters.Set("DeliveryReportEnabled", true);
                 sessionParameters.Set("NDREnabled", true);
                 sessionParameters.Set("DisplaySenderName", true);
                 sessionParameters.Set("TNEFEnabled", true);
             }
             base.OnPremisesSession.SetRemoteDomain(domainContentConfig.Identity.ToString(), sessionParameters);
         }
     }
 }
示例#16
0
        public void NewOrganizationRelationship(string name, string targetApplicationUri, string targetAutodiscoverEpr, IEnumerable <SmtpDomain> domainNames)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Name", name);
            sessionParameters.Set("TargetApplicationUri", targetApplicationUri);
            sessionParameters.Set("TargetAutodiscoverEpr", targetAutodiscoverEpr);
            sessionParameters.Set("Enabled", true);
            sessionParameters.Set <SmtpDomain>("DomainNames", domainNames, (SmtpDomain d) => d.Domain);
            this.RemotePowershellSession.RunCommand("New-OrganizationRelationship", sessionParameters);
        }
示例#17
0
        private SessionParameters BuildParameters(IOnPremisesOrganization configuration)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set <SmtpDomain>("HybridDomains", configuration.HybridDomains, (SmtpDomain d) => d.Domain);
            sessionParameters.Set("InboundConnector", TaskCommon.ToStringOrNull(configuration.InboundConnector));
            sessionParameters.Set("OutboundConnector", TaskCommon.ToStringOrNull(configuration.OutboundConnector));
            sessionParameters.Set("OrganizationRelationship", TaskCommon.ToStringOrNull(configuration.OrganizationRelationship));
            sessionParameters.Set("OrganizationName", configuration.OrganizationName);
            return(sessionParameters);
        }
示例#18
0
        public void SetReceiveConnector(IReceiveConnector configuration)
        {
            SessionParameters sessionParameters = new SessionParameters();

            if (configuration.Identity != null)
            {
                sessionParameters.Set("Identity", configuration.Identity.ToString());
            }
            sessionParameters.Set("TLSCertificateName", TaskCommon.ToStringOrNull(configuration.TlsCertificateName));
            sessionParameters.Set("TLSDomainCapabilities", TaskCommon.ToStringOrNull(configuration.TlsDomainCapabilities));
            base.RemotePowershellSession.RunOneCommand("Set-ReceiveConnector", sessionParameters, false);
        }
示例#19
0
        public void NewIntraOrganizationConnector(string name, string discoveryEndpoint, string onlineTargetAddress, bool enabled)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Name", name);
            sessionParameters.Set("DiscoveryEndpoint", discoveryEndpoint);
            MultiValuedProperty <SmtpDomain> multiValuedProperty = new MultiValuedProperty <SmtpDomain>();
            SmtpDomain item = new SmtpDomain(onlineTargetAddress);

            multiValuedProperty.TryAdd(item);
            sessionParameters.Set <SmtpDomain>("TargetAddressDomains", multiValuedProperty);
            sessionParameters.Set("Enabled", enabled);
            base.RemotePowershellSession.RunOneCommand("New-IntraOrganizationConnector", sessionParameters, false);
        }
示例#20
0
        public void SetEmailAddressPolicy(string identity, string includedRecipients, ProxyAddressTemplateCollection enabledEmailAddressTemplates)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.Set("ForceUpgrade", true);
            if (!string.IsNullOrEmpty(includedRecipients))
            {
                sessionParameters.Set("IncludedRecipients", includedRecipients);
            }
            if (enabledEmailAddressTemplates != null)
            {
                sessionParameters.Set <ProxyAddressTemplate>("EnabledEmailAddressTemplates", enabledEmailAddressTemplates);
            }
            base.RemotePowershellSession.RunCommand("Set-EmailAddressPolicy", sessionParameters);
        }
示例#21
0
        public void AddFederatedDomain(string domainName)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("DomainName", domainName);
            base.RemotePowershellSession.RunCommand("Add-FederatedDomain", sessionParameters);
        }
示例#22
0
        public void SetSendConnector(ISendConnector configuration)
        {
            SessionParameters sessionParameters = this.SetSendConnectorParameters(configuration);

            sessionParameters.Set("Identity", configuration.Identity.ToString());
            base.RemotePowershellSession.RunOneCommand("Set-SendConnector", sessionParameters, false);
        }
        public List <Dictionary <string, object> > GetPowershellUntypedObjectsAsMembers(string command, string identity, SessionParameters parameters)
        {
            if (!string.IsNullOrEmpty(identity))
            {
                parameters.Set("Identity", identity);
            }
            Collection <PSObject> collection = this.RunCommand(command, parameters, true);

            if (collection == null || collection.Count == 0)
            {
                this.logger.LogInformation(HybridStrings.HybridInfoObjectNotFound);
                return(null);
            }
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();

            foreach (PSObject psobject in collection)
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                foreach (PSMemberInfo psmemberInfo in psobject.Members)
                {
                    dictionary.Add(psmemberInfo.Name, psmemberInfo.Value);
                }
                list.Add(dictionary);
            }
            return(list);
        }
示例#24
0
        public IntraOrganizationConnector GetIntraOrganizationConnector(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            return(base.RemotePowershellSession.RunOneCommandSingleResult <IntraOrganizationConnector>("Get-IntraOrganizationConnector", sessionParameters, true));
        }
示例#25
0
        public void SetOutboundConnector(IOutboundConnector configuration)
        {
            SessionParameters sessionParameters = this.BuildParameters(configuration);

            sessionParameters.Set("Identity", configuration.Identity.ToString());
            base.RemotePowershellSession.RunCommand("Set-OutboundConnector", sessionParameters);
        }
示例#26
0
        public void SetFederationTrustRefreshMetadata(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            sessionParameters.SetNull <bool>("RefreshMetadata");
            base.RemotePowershellSession.RunCommand("Set-Federationtrust", sessionParameters);
        }
示例#27
0
        public IEnumerable <IExchangeCertificate> GetExchangeCertificate(string server)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Server", server);
            return(from c in base.RemotePowershellSession.RunOneCommand <ExchangeCertificate>("Get-ExchangeCertificate", sessionParameters, true)
                   select new PowerShellOnPremisesSession.Certificate(c));
        }
示例#28
0
        private SessionParameters BuildParameters(IOutboundConnector configuration)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Name", configuration.Name);
            sessionParameters.Set <SmtpDomainWithSubdomains>("RecipientDomains", configuration.RecipientDomains);
            sessionParameters.Set <SmartHost>("SmartHosts", configuration.SmartHosts);
            sessionParameters.Set("ConnectorType", configuration.ConnectorType);
            sessionParameters.Set("TLSSettings", (Enum)configuration.TlsSettings);
            sessionParameters.Set("TLSDomain", configuration.TlsDomain);
            sessionParameters.Set("CloudServicesMailEnabled", configuration.CloudServicesMailEnabled);
            sessionParameters.Set("RouteAllMessagesViaOnPremises", configuration.RouteAllMessagesViaOnPremises);
            sessionParameters.Set("UseMxRecord", false);
            return(sessionParameters);
        }
示例#29
0
        public IEnumerable <ADWebServicesVirtualDirectory> GetWebServicesVirtualDirectory(string server)
        {
            SessionParameters sessionParameters = new SessionParameters();

            if (server != null)
            {
                sessionParameters.Set("Server", server);
            }
            return(base.RemotePowershellSession.RunOneCommand <ADWebServicesVirtualDirectory>("Get-WebServicesVirtualDirectory", (server != null) ? sessionParameters : null, true));
        }
示例#30
0
        public IOutboundConnector GetOutboundConnector(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            TenantOutboundConnector tenantOutboundConnector = base.RemotePowershellSession.RunOneCommandSingleResult <TenantOutboundConnector>("Get-OutboundConnector", sessionParameters, true);

            if (tenantOutboundConnector != null)
            {
                return(new OutboundConnector(tenantOutboundConnector));
            }
            return(null);
        }