zakird / pyad

Python Active Directory Tools | *Not actively maintained*
http://zakird.github.io/pyad/
176 stars 72 forks source link

Rename a group #154

Open PapaOursNoob opened 2 years ago

PapaOursNoob commented 2 years ago

Hello,

I am trying to rename a global security group. It partially works. The Samaccountname isn't modified, the CN is.

And I always have an error :

Traceback (most recent call last): File "E:\Poste de travail local\Script\Python\AD-admin.py", line 116, in GroupAD.rename("Renommage",False) File "C:\Program Files\Python310\lib\site-packages\pyad-0.5.20-py3.10.egg\pyad\adobject.py", line 460, in rename File "C:\Program Files\Python310\lib\site-packages\pyad-0.5.20-py3.10.egg\pyad\adobject.py", line 226, in __set_gc_adsi_obj File "<COMObject >", line 2, in OpenDSObject pywintypes.com_error: (-2147352567, 'Une exception s’est produite.', (0, 'Active Directory', 'Cet objet ne se trouve pas sur le serveur.\r\n', None, 0, -2147016656), None)

it seems like the object can't be found juste after it is renamed.

I have a workaround for the Samaccountname. Do you have any idea why it is bahaving this way ?

PapaOursNoob commented 2 years ago

I think, there is a problem with distinguished name that doesn't exist in a group

PapaOursNoob commented 2 years ago

I found the problem : Line 455
self.__distinguishedName = self.get_attribute('distinguishedName', False) instead of self.__distinguished_name = self.get_attribute('distinguishedName', False)