Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Can not remove an item from an ARRAY

$
0
0

Hello,

I'm getting a list of groups that a user belongs too.

I don't want "Domain users" or "users" as part of the array. I have tried this scenario below to remove with no luck.

What is the best way to accomplish this removal?

[System.Collections.ArrayList]$ListArray2 = GetGroups $user
$listarray2.Remove("CN=Domain Users,CN=Builtin,DC=hteeter,DC=ht")
$listarray2.Remove("Users")
$ADGroups=$listarray2


Viewing all articles
Browse latest Browse all 6937

Trending Articles