![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | ADSI Inconsistent behavior Hi, Is anyone else getting inconsistent behavior when using ADSI via Powershell? I'm trying to add users into groups. An example is: $AllUsersGroup = [ADSI]"LDAP://cn=AllUsers@testgroup,cn=users,dc=test,dc=com" $AllUsersGroup.Member.Add("cn=user1,cn=users,dc=test,dc=com") $AllUsersGroup.psbase.CommitChanges() However, sometimes 0 is returned from the "Member.Add" line and sometimes its a 1 (indicating the user has been added). Any idea why it works sometimes and not others? Thanks, Dave. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: ADSI Inconsistent behavior Hello Dave, > $AllUsersGroup = > [ADSI]"LDAP://cn=AllUsers@testgroup,cn=users,dc=test,dc=com" > $AllUsersGroup.Member.Add("cn=user1,cn=users,dc=test,dc=com") > $AllUsersGroup.psbase.CommitChanges() > > However, sometimes 0 is returned from the "Member.Add" line and > sometimes its a 1 (indicating the user has been added). if i did my research correctly the page: http://msdn2.microsoft.com/en-us/lib...ction.add.aspx mentions that the return value of Add is the 0 based index of the item added. it will throw an exception if it cannot add the user, so perhaps the return code is not of much use? thanks, mark |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
Inconsistent Picture Preview Behavior | General Discussion | |||
| inconsistent behavior | PowerShell | |||
| Re: Inconsistent behavior with color rules | Live Mail | |||
| Baffled by Inconsistent and Irrational Vista Backup Behavior | Vista performance & maintenance | |||
| Smart-quote behavior: Is current behavior ideal? | PowerShell | |||