.NET Framework - ADSI and group membership - what am I doing wrong
Asked By Neil Chambers
13-Jul-07 12:43 PM
I am trying to commit changes to group membership but nothing seems to happen
can find this in the PSBase:
nadda
What gives?
Cheers :-)
Neil
Active Directory
(1)
QADGroupMember
(1)
QADService
(1)
QADGroup
(1)
PSBase
(1)
ConnectionPassword
(1)
ConnectionAccount
(1)
UYNli.26447
(1)
Clint Bergman replied...
Here's a version of how I have successfully added a member to a group. I just installed the Quest AD cmdlets yesterday
and am looking at how we might use those to accomplish the task.....
$ADS_PROPERTY_APPEND = 3
$user = [ADSI]"LDAP://<PATH_TO_USER>"
$group = [ADSI]"LDAP://<PATH_TO_GROUP>"
$group.putEx($ADS_PROPERTY_APPEND,"member",@($user.distinguishedname))
$group.setInfo()
Neil Chambers replied...
Thanks Chris,
As you used the SetInfo() method I thought I would try it even though it
is not listed in the member properties of the object??
Anyway - my method now works a treat.
Cheers,
Neil
Jason replied...
For a discussion of the invisible methods, see:
http://pathologicalscripter.wordpress.com/2006/09/28/invisible-methods-for-adsi/
Cheers,
Jason
------------------------------------------------------
PowerShell Training at SANS Conferences
http://www.WindowsPowerShellTraining.com
------------------------------------------------------
Rich replied...
If at all possible use the cmdlets - they make life so much easier
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk
Active Directory and group copy .NET Framework Hi everybody, I'd like to move the group members another group. I've isntalled the Quest cmdlets. I think the solution is near Add-QADGroupMember but I don't know how to use these. . . What is the best practices to do that ? Thanks ! Powershell Discussions Active Directory (1) QADGroupMember (1) NewGroupName (1) OldGroupName (1) GroupName (1) JoeUser (1) GroupB (1) GroupA (1) Try Get QADGroupMember GroupA | % { Add-QADGroupMember GroupB -Member $_ } - -- -- Shay Levi $cript Fanatic http: / / scriptolog.blogspot.com I've find a
NET Framework Hi Does anyone have a script tht will print / export Group memberships in Active Directory? I am trying to run a report so that we can see what users are in what distribution and security groups. Thanks Powershell Discussions Active Directory (1) QADGroupMember (1) Report (1) GroupName (1) Memberships (1) Quests (1) Activeroles (1) Cmdlets (1) I have always preferred Quests AD cmdlets for this type of task: Get-QADGroupMember GroupName Take a look: http: / / www.quest.com / activeroles-server / arms.aspx - - Regards, jfrmilner keywords Memberships description: Hi Does anyone have a script tht will print / export Group memberships in Active Directory I am trying to run a report so that we can see what users are
a csv file .NET Framework Hi guys . when i use the powershell to extract the active directory users of a certain group i use the command Get-QADGroupMember Get-QADGroupMember 'domain \ group name ' my question is how do i upload the results on a csv this script to export it directly to a csv file ? tnx in advance Powershell Discussions QADGroupMember (1) CanonicalName (1) GroupName (1) Identity (1) Nielsen (1) Raanana (1) Scriptfanatic (1) Directory (1) You can try Export-Csv: Get-QADGroupMember Get-QADGroupMember 'domain \ group name' | Export-Csv -path pathToFilename.csv - -- -- Shay Levi $cript Fanatic http: / / scriptolog.blogspot
Active Directory removing nested groups and subsequently members .NET Framework Hi I'm getting myself tied in distinguishedname $V = $objUserFoundUser[0].properties.objectcategory Write-Host $U Write-Host $V } } } } } - - jobbsy@ Powershell Discussions Active Directory (1) DirectoryServices.DirectorySearcher (1) ObjADSearcher.FindAll (1) QADGroupMember (1) IGroup.group (1) ObjADSearcher.filter (1) ObjUserFoundUser (1) ObjADSearcher (1) Hi Jobbsy, Try Quest Active Directory cmdlets, its FREE. One of the cmdlets: Get QADGroupMember have support for nested groups: Get-QADGroupMember -identity administrators -Indirect This will give you all