Solved

Error with Putex in adding members to a group

Posted on 2010-09-14
2
1,946 Views
Last Modified: 2012-05-10
I have an array of distinguished names that I'm trying to remove from a group and I keep getting this error:

Exception calling "PutEx" with "3" argument(s): "Unspecified error
"
At E:\scripts\spresley\dev_test.ps1:113 char:17
+     $groupObj.PutEx <<<< (4, "Member", $removeMember) #remove members
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI

The group is a large group (over 2,000 existing members) and I'm trying to remove some members.

 
$groupObj = [ADSI]"LDAP://<domainController>/$groupDN"

#removeMember has some valid DN's to remove.
$groupObj.PutEx(4, "Member", $removeMember)

Open in new window


I'm wondering if I'm running into a problem because the group member size is over 1,500 and if I'll need to replace (2) instead of remove (4) using PutEx.  Any one know what's going on?
0
Comment
Question by:evetsleep
2 Comments
 
LVL 13

Accepted Solution

by:
soostibi earned 500 total points
Comment Utility
Is $removemember an array? Even if it has one element, it must be an array, so you should use this:

$groupObj.PutEx(4, "Member", @($removeMember))

Open in new window

0
 
LVL 1

Author Comment

by:evetsleep
Comment Utility
I had created $removeMember as an array:

$removeMember = @()

However that seems to not have been good enough.  I was able to reproduce the problem and when I put in my code what you suggested it was fixed.  Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Synchronize a new Active Directory domain with an existing Office 365 tenant
A procedure for exporting installed hotfix details of remote computers using powershell
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now