public override void ExecuteCmdlet() { ExecutionBlock(() => { if (this.IsParameterBound(c => c.GroupObject)) { GroupObjectId = GroupObject.Id; } else if (this.IsParameterBound(c => c.GroupDisplayName)) { var targetGroup = ActiveDirectoryClient.GetGroupByDisplayName(GroupDisplayName); GroupObjectId = targetGroup.Id; } ADObjectFilterOptions options = new ADObjectFilterOptions { Id = GroupObjectId, Paging = true }; PSADObject group = ActiveDirectoryClient.FilterGroups(options).FirstOrDefault(); if (group == null) { throw new KeyNotFoundException(string.Format(ProjectResources.GroupDoesntExist, GroupObjectId)); } ulong first = MyInvocation.BoundParameters.ContainsKey("First") ? this.PagingParameters.First : ulong.MaxValue; ulong skip = MyInvocation.BoundParameters.ContainsKey("Skip") ? this.PagingParameters.Skip : 0; WriteObject(ActiveDirectoryClient.GetGroupMembers(options, first, skip), true); }); }
public override void ExecuteCmdlet() { ADObjectFilterOptions options = new ADObjectFilterOptions { Id = GroupObjectId == Guid.Empty ? null : GroupObjectId.ToString(), Paging = true }; do { WriteObject(ActiveDirectoryClient.GetGroupMembers(options), true); } while (!string.IsNullOrEmpty(options.NextLink)); }
public override void ExecuteCmdlet() { ExecutionBlock(() => { ADObjectFilterOptions options = new ADObjectFilterOptions { Id = GroupObjectId == Guid.Empty ? null : GroupObjectId.ToString(), Paging = true }; PSADObject group = ActiveDirectoryClient.FilterGroups(options).FirstOrDefault(); if (group == null) { throw new KeyNotFoundException(string.Format(ProjectResources.GroupDoesntExist, GroupObjectId)); } do { WriteObject(ActiveDirectoryClient.GetGroupMembers(options), true); } while (!string.IsNullOrEmpty(options.NextLink)); }); }