Search code examples
pythonactive-directorypython-3.7pyad

Python PyAD setting multiple workstations during creation of user


Trying to add multiple workstations using pyad. I am able to set a single workstation, but not multiple workstations.

from pyad import aduser

ou = pyad.adcontainer.ADContainer.from_dn(
  "ou=someplace, DC=domain, DC=com")
new_user=pyad.aduser.ADUser.create(
      "test02", ou, password="password123",
       optional_attributes= 
       {'userWorkstations':
        'computer1','computer2'}) 

I've also tried using ldap3 with the same result. It completes the operation, but when looking in Active Directory, it only sets the first workstation.


Solution

  • after looking at the ADSI editor in Active Directory, I found my mistake.

    'userWorkstations' :"computer1,computer2"
    

    my mistake was that I had a space after the comma. Thank-you for everyone's assistance.