Michiel,
Make sure you possess the appropriate write access to the object, and check your code against the below article. Adding/Removing a Manager Object with ADSI (Visual Basic) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cl b_adding_removing_a_manager_object_with_adsi_vb.asp The 'manager' attribute should accept a properly formatted DN to an existing user object (i.e. - the new manager). The 'manager' value is linked to the calculated 'directReports' attribute on the managing User object. Below is a Perl snippet that will do what you ask. I've tested it so I know it works with the proper credentials (mind that it doesn't have a lot of error-handling). use strict; use Win32::OLE 'in'; use Win32::OLE::Const 'Active DS Type Library'; $Win32::OLE::Warn = 3; # domain/access variables my $adm = "DOMAIN\\userid"; my $pwd = "password"; my $adc = "domaincontroller.mycompany.com"; # user and manager DNs my $usr = "CN=dilbert,OU=cubicle workers,DC=mycompany,DC=com"; my $mgr = "CN=theboss,OU=evil managers,DC=mycompany,DC=com"; &add_employee_mgr($adc, $usr, $adm, $pwd, $mgr); # add a manager to a user object #--------------------------------------------------------- sub add_employee_mgr { #--------------------------------------------------------- my ($adc, $usrpath, $admact, $passwd, $mgrpath) = @_; my $DSO = Win32::OLE->GetObject("LDAP:"); my $DSBind = $DSO->OpenDSObject("LDAP://".$adc."/".$usrpath, $admact, $passwd, ADS_SECURE_AUTHENTICATION); $DSBind->{'manager'} = $mgrpath; $DSBind->SetInfo(); } Hope this helps, Richard > -----Original Message----- > From: Roger Seielstad [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 14, 2002 8:14 AM > To: '[EMAIL PROTECTED]' > Subject: RE: [ActiveDir] How to change the manager of a user > > > Maybe try the RDN? In other words, leave off the DC= parts? > > I'm not having any luck searching MSDN right now (not enough > coffee) but if you dig around enough you can probably find a > reference to the exact format that is expected in that field. > > ------------------------------------------------------ > Roger D. Seielstad - MCSE > Sr. Systems Administrator > Inovis - Formerly Harbinger and Extricity > Atlanta, GA > > > > -----Original Message----- > > From: Michiel van Kleef [mailto:[EMAIL PROTECTED]] > > Sent: Monday, October 14, 2002 3:03 AM > > To: '[EMAIL PROTECTED]' > > Subject: RE: [ActiveDir] How to change the manager of a user > > > > > > I'm doing it programmatically using the distinguished name > > but then I get > > this error. > > > > -----Oorspronkelijk bericht----- > > Van: Roger Seielstad [mailto:[EMAIL PROTECTED]] > > Verzonden: Friday, October 11, 2002 14:11 > > Aan: '[EMAIL PROTECTED]' > > Onderwerp: RE: [ActiveDir] How to change the manager of a user > > > > Are you doing it through the GUI or programatically? > > > > Through the GUI, I believe it expects the display name. > > Programatically, you > > would need to use a distinguished name > > > > ------------------------------------------------------ > > Roger D. Seielstad - MCSE > > Sr. Systems Administrator > > Inovis - Formerly Harbinger and Extricity > > Atlanta, GA > > > > > > > -----Original Message----- > > > From: Michiel van Kleef [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, October 11, 2002 3:21 AM > > > To: '[EMAIL PROTECTED]' > > > Subject: [ActiveDir] How to change the manager of a user > > > > > > > > > Hi, > > > > > > > > > > > > How do I change the manager of a user? When I get the manager > > > property I get something like "CN=a manager,OU=..., OU=... > > > etc." I know how to get the user object of this manager, but > > > I don't know how to change it. I tried to put a string like > > > "CN= another manager, OU=..., OU=..." in the Manager > > > property, but this does not work. Then I get the following > > > message: "General access denied error". > > > > > > > > > > > > M.R. van Kleef > > > > > > > > List info : http://www.activedir.org/mail_list.htm > > List FAQ : http://www.activedir.org/list_faq.htm > > List archive: > > http://www.mail-archive.com/activedir%> 40mail.activedir.org/ > > > > List info : > > http://www.activedir.org/mail_list.htm > > List FAQ : http://www.activedir.org/list_faq.htm > > List archive: > > http://www.mail-archive.com/activedir%> 40mail.activedir.org/ > > > List info : http://www.activedir.org/mail_list.htm > List FAQ : http://www.activedir.org/list_faq.htm > List archive: > http://www.mail-archive.com/activedir%> 40mail.activedir.org/ > List info : http://www.activedir.org/mail_list.htm List FAQ : http://www.activedir.org/list_faq.htm List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
