private IEnumerable <T> ApplyPartitionFilter(IEnumerable <T> objectList) { string[] item = base.CmdletSessionInfo.CmdletParameters["PartitionFilter"] as string[]; if (item == null) { string[] strArrays = new string[1]; strArrays[0] = "Default"; item = strArrays; } if (!item.Contains <string>("*")) { IEnumerable <string> strs = ADForestPartitionInfo.ConstructPartitionList(base.CmdletSessionInfo.ADRootDSE, item, false); List <T> ts = new List <T>(); foreach (T t in objectList) { if (!strs.Contains <string>(t.Partition)) { continue; } ts.Add(t); } return(ts); } else { return(objectList); } }
// Methods internal override void PerServerProcessRecord() { ADObjectFactory <ADObject> factory = new ADObjectFactory <ADObject>(); CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo(); factory.SetCmdletSessionInfo(cmdletSessionInfo); base._factory.SetCmdletSessionInfo(cmdletSessionInfo); string[] propertiesToFetch = new string[] { "msDS-NCReplCursors" }; string[] partitionList = base._cmdletParameters["PartitionFilter"] as string[]; if (partitionList == null) { partitionList = new string[] { "Default" }; } foreach (string str in ADForestPartitionInfo.ConstructPartitionList(cmdletSessionInfo.ADRootDSE, partitionList, false)) { ADObject identityObj = new ADObject(str); try { identityObj = factory.GetExtendedObjectFromIdentity(identityObj, cmdletSessionInfo.DefaultPartitionPath, propertiesToFetch); } catch (Exception exception) { if (!(exception is ADIdentityNotFoundException) && !(exception is ADReferralException)) { throw exception; } continue; } foreach (ADReplicationUpToDatenessVectorTable table in base._factory.GetExtendedObjectFromDirectoryObject(identityObj, "msDS-NCReplCursors", "DS_REPL_CURSOR")) { base.WriteObject(table); } } }
internal override void PerServerProcessRecord() { ADObjectFactory <ADObject> factory = new ADObjectFactory <ADObject>(); CmdletSessionInfo cmdletSessionInfo = this.GetCmdletSessionInfo(); factory.SetCmdletSessionInfo(cmdletSessionInfo); base._factory.SetCmdletSessionInfo(cmdletSessionInfo); string[] partitionList = base._cmdletParameters["PartitionFilter"] as string[]; if (partitionList == null) { partitionList = new string[] { "Default" }; } foreach (string str in ADForestPartitionInfo.ConstructPartitionList(cmdletSessionInfo.ADRootDSE, partitionList, false)) { ADObject identityObj = new ADObject(str); try { identityObj = factory.GetExtendedObjectFromIdentity(identityObj, cmdletSessionInfo.DefaultPartitionPath, this._propertiesRequested); } catch (Exception exception) { if (!(exception is ADIdentityNotFoundException) && !(exception is ADReferralException)) { throw exception; } continue; } if (this._propertiesRequested.Contains <string>("msDS-NCReplInboundNeighbors")) { foreach (ADReplicationPartnerMetadata metadata in base._factory.GetExtendedObjectFromDirectoryObject(identityObj, "msDS-NCReplInboundNeighbors", "DS_REPL_NEIGHBOR")) { base.WriteObject(metadata); } } if (this._propertiesRequested.Contains <string>("msDS-NCReplOutboundNeighbors")) { foreach (ADReplicationPartnerMetadata metadata2 in base._factory.GetExtendedObjectFromDirectoryObject(identityObj, "msDS-NCReplOutboundNeighbors", "DS_REPL_NEIGHBOR")) { base.WriteObject(metadata2); } } } }