internal static string GetCurrentPartitionPath(SessionState sessionState) { ADRootDSE rootDSE; string str = null; ADDriveInfo current = sessionState.Drive.Current as ADDriveInfo; if (current != null) { using (ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(current.SessionInfo)) { rootDSE = aDObjectSearcher.GetRootDSE(); rootDSE.SessionInfo = current.SessionInfo; } string currentDriveLocation = ProviderUtils.GetCurrentDriveLocation(sessionState, current.SessionInfo); if (currentDriveLocation != string.Empty) { try { str = ADForestPartitionInfo.ExtractAndValidatePartitionInfo(rootDSE, currentDriveLocation); } catch (ArgumentException argumentException1) { ArgumentException argumentException = argumentException1; object[] objArray = new object[1]; objArray[0] = currentDriveLocation; throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ProviderUtilInvalidDrivePath, objArray), argumentException); } } else { return(string.Empty); } } return(str); }
protected internal override string GetDefaultPartitionPath() { string item = this._cmdletParameters["SearchBase"] as string; if (string.IsNullOrEmpty(item)) { return(base.GetDefaultPartitionPath()); } else { return(ADForestPartitionInfo.ExtractAndValidatePartitionInfo(this.GetRootDSE(), item)); } }
private void ValidateMemberOfParameter() { ADGroup extendedObjectFromIdentity; if (!this._isMemberOfValidated) { this._validExtendedGroupPartitionPairList = new List <SetADPrincipalGroupMembership <P> .ADGroupPartitionDNPair>(); object item = this._cmdletParameters["MemberOf"]; ADPrincipal[] aDPrincipalArray = item as ADGroup[]; if (aDPrincipalArray == null) { ADGroup aDGroup = item as ADGroup; if (aDGroup != null) { ADGroup[] aDGroupArray = new ADGroup[1]; aDGroupArray[0] = aDGroup; aDPrincipalArray = aDGroupArray; } } if (aDPrincipalArray != null) { new Hashtable(); ADGroupFactory <ADGroup> aDGroupFactory = new ADGroupFactory <ADGroup>(); CmdletSessionInfo cmdletSessionInfo = base.GetCmdletSessionInfo(); aDGroupFactory.SetCmdletSessionInfo(cmdletSessionInfo); ADPrincipal[] aDPrincipalArray1 = aDPrincipalArray; for (int i = 0; i < (int)aDPrincipalArray1.Length; i++) { ADGroup aDGroup1 = (ADGroup)aDPrincipalArray1[i]; try { if (!aDGroup1.IsSearchResult) { extendedObjectFromIdentity = aDGroupFactory.GetExtendedObjectFromIdentity(aDGroup1, cmdletSessionInfo.DefaultPartitionPath); this._validExtendedGroupPartitionPairList.Add(new SetADPrincipalGroupMembership <P> .ADGroupPartitionDNPair(extendedObjectFromIdentity)); } else { extendedObjectFromIdentity = aDGroup1; using (ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(extendedObjectFromIdentity.SessionInfo)) { ADRootDSE rootDSE = aDObjectSearcher.GetRootDSE(); string str = ADForestPartitionInfo.ExtractAndValidatePartitionInfo(rootDSE, extendedObjectFromIdentity.DistinguishedName); this._validExtendedGroupPartitionPairList.Add(new SetADPrincipalGroupMembership <P> .ADGroupPartitionDNPair(extendedObjectFromIdentity, str)); } } } catch (ADIdentityNotFoundException aDIdentityNotFoundException1) { ADIdentityNotFoundException aDIdentityNotFoundException = aDIdentityNotFoundException1; DebugLogger.LogError("SetADPrincipalGroupMembership", aDIdentityNotFoundException.ToString()); base.ThrowTerminatingError(new ErrorRecord(aDIdentityNotFoundException, "SetADPrincipalGroupMembership:ValidateMemberOfParameter", ErrorCategory.ObjectNotFound, aDGroup1)); } } } this._isMemberOfValidated = true; return; } else { return; } }