Solved

Error with Putex in adding members to a group

Posted on 2010-09-14
2
1,963 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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

815 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

9 Experts available now in Live!

Get 1:1 Help Now