Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error with Putex in adding members to a group

Posted on 2010-09-14
2
Medium Priority
?
2,008 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
soostibi earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

721 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