Exemplo n.º 1
0
        internal static void ToExtendedFromDNToISTPEnum(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
        {
            string value = (string)directoryObj[directoryAttributes[0]].Value;

            value = ADPathModule.GetParentPath(value, null, ADPathFormat.X500);
            string childName = ADPathModule.GetChildName(value, ADPathFormat.X500);
            ADInterSiteTransportProtocolType aDInterSiteTransportProtocolType = ADInterSiteTransportProtocolType.IP;

            if (string.Compare("CN=IP", childName, StringComparison.OrdinalIgnoreCase) != 0)
            {
                aDInterSiteTransportProtocolType = ADInterSiteTransportProtocolType.SMTP;
            }
            ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection((object)aDInterSiteTransportProtocolType);

            userObj.Add(extendedAttribute, aDPropertyValueCollection);
        }
Exemplo n.º 2
0
        private bool ADMoveCmdletBaseProcessCSRoutine()
        {
            bool flag;
            O    item = (O)this._cmdletParameters["Identity"];

            this.SetPipelinedSessionInfo(item.SessionInfo);
            CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo();

            this._factory.SetCmdletSessionInfo(cmdletSessionInfo);
            this.ValidateParameters();
            string   defaultPartitionPath        = this.GetDefaultPartitionPath();
            ADObject directoryObjectFromIdentity = this._factory.GetDirectoryObjectFromIdentity(item, defaultPartitionPath);

            using (ADActiveObject aDActiveObject = new ADActiveObject(cmdletSessionInfo.ADSessionInfo, directoryObjectFromIdentity))
            {
                if (base.ShouldProcessOverride(directoryObjectFromIdentity.DistinguishedName, "Move"))
                {
                    O o = default(O);
                    if (this._factory.PreCommitProcesing(ADFactory <O> .DirectoryOperation.Move, o, this._cmdletParameters, directoryObjectFromIdentity))
                    {
                        aDActiveObject.Update();
                    }
                    string str       = this._cmdletParameters["TargetPath"] as string;
                    string childName = ADPathModule.GetChildName(directoryObjectFromIdentity.DistinguishedName, ADPathFormat.X500);
                    string item1     = null;
                    if (!this._cmdletParameters.Contains("TargetServer"))
                    {
                        aDActiveObject.Move(str, childName);
                    }
                    else
                    {
                        item1 = this._cmdletParameters["TargetServer"] as string;
                        aDActiveObject.CrossDomainMove(str, childName, item1);
                    }
                    O o1 = default(O);
                    this._factory.PostCommitProcesing(ADFactory <O> .DirectoryOperation.Move, o1, this._cmdletParameters, directoryObjectFromIdentity);
                    if (this._cmdletParameters.GetSwitchParameterBooleanValue("PassThru"))
                    {
                        ADSessionInfo aDSessionInfo = cmdletSessionInfo.ADSessionInfo;
                        if (this._cmdletParameters.Contains("TargetServer"))
                        {
                            aDSessionInfo.Server = item1;
                        }
                        string str1 = ADPathModule.MakePath(str, childName, ADPathFormat.X500);
                        F      f    = Activator.CreateInstance <F>();
                        using (ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(aDSessionInfo))
                        {
                            ADRootDSE     rootDSE       = aDObjectSearcher.GetRootDSE();
                            ADCmdletCache aDCmdletCache = new ADCmdletCache();
                            aDSessionInfo.ServerType = Utils.ADServerTypeFromRootDSE(rootDSE);
                            CmdletSessionInfo cmdletSessionInfo1 = new CmdletSessionInfo(aDSessionInfo, rootDSE, rootDSE.DefaultNamingContext, rootDSE.DefaultNamingContext, rootDSE.DefaultNamingContext, aDSessionInfo.ServerType, aDCmdletCache, this, this, this._cmdletParameters);
                            f.SetCmdletSessionInfo(cmdletSessionInfo1);
                            O extendedObjectFromDN = this._factory.GetExtendedObjectFromDN(str1);
                            base.WriteObject(extendedObjectFromDN);
                            aDCmdletCache.Clear();
                        }
                    }
                    return(true);
                }
                else
                {
                    flag = false;
                }
            }
            return(flag);
        }