Solved

Error with Putex in adding members to a group

Posted on 2010-09-14
2
1,970 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
ID: 33678004
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
ID: 33682464
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
A brief introduction to what I consider to be the best editor for PowerShell.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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