示例#1
0
        private bool ADTargetScopeEnumerationServerPreProcessPipelineCSRoutine()
        {
            if (!this._cmdletParameters.ContainsKey("Target"))
            {
                ADScopeType?item = (ADScopeType?)(this._cmdletParameters["Scope"] as ADScopeType?);
                if (item.Value != ADScopeType.Server)
                {
                    CmdletSessionInfo  cmdletSessionInfo  = this.GetCmdletSessionInfo();
                    ADDomainController aDDomainController = new ADDomainController(cmdletSessionInfo.ADRootDSE.DNSHostName);
                    ADDomainControllerFactory <ADDomainController> aDDomainControllerFactory = new ADDomainControllerFactory <ADDomainController>();
                    aDDomainControllerFactory.SetCmdletSessionInfo(cmdletSessionInfo);
                    ADDomainController extendedObjectFromIdentity = aDDomainControllerFactory.GetExtendedObjectFromIdentity(aDDomainController, null, null, false);
                    ADScopeType?       nullable       = (ADScopeType?)(this._cmdletParameters["Scope"] as ADScopeType?);
                    ADScopeType        valueOrDefault = nullable.GetValueOrDefault();
                    if (nullable.HasValue)
                    {
                        switch (valueOrDefault)
                        {
                        case ADScopeType.Domain:
                        {
                            string[] domain = new string[1];
                            domain[0] = extendedObjectFromIdentity.Domain;
                            this._cmdletParameters["Target"] = domain;
                            break;
                        }

                        case ADScopeType.Forest:
                        {
                            string[] forest = new string[1];
                            forest[0] = extendedObjectFromIdentity.Forest;
                            this._cmdletParameters["Target"] = forest;
                            break;
                        }

                        case ADScopeType.Site:
                        {
                            string[] site = new string[1];
                            site[0] = extendedObjectFromIdentity.Site;
                            this._cmdletParameters["Target"] = site;
                            break;
                        }
                        }
                    }
                }
                else
                {
                    throw new ADException(StringResources.ServerTargetParameterNotSpecified);
                }
            }
            return(true);
        }
示例#2
0
 private bool ADGetSiteCmdletCalculateIdentityCSRoutine()
 {
     if (this._cmdletParameters["Identity"] == null)
     {
         if (this._cmdletParameters["Filter"] == null)
         {
             CmdletSessionInfo  cmdletSessionInfo  = this.GetCmdletSessionInfo();
             ADDomainController aDDomainController = new ADDomainController(cmdletSessionInfo.ADRootDSE.DNSHostName);
             ADDomainControllerFactory <ADDomainController> aDDomainControllerFactory = new ADDomainControllerFactory <ADDomainController>();
             aDDomainControllerFactory.SetCmdletSessionInfo(cmdletSessionInfo);
             ADDomainController extendedObjectFromIdentity = aDDomainControllerFactory.GetExtendedObjectFromIdentity(aDDomainController, null, null, false);
             this._cmdletParameters["Identity"] = new ADReplicationSite(extendedObjectFromIdentity.Site);
             return(true);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         return(true);
     }
 }