How to create a new user in Active directory using Python pyad module
<p>I am trying to create 100 000 users in Active Directory with different attributes. I am trying this with pyad module as shown below:</p>

<pre><code>from pyad import *


user = aduser.ADUser.from_cn("test")
pyad.set_defaults(ldap_server="blr.test.local", username="Administrator", password="test@123")
ou = ADContainer.from_dn("ou=users, dc=test, dc=local")
new_user = ADUser.create("ADUSER123123", ou, password="Secret123")
</code></pre>

<p>But I am getting below error:</p>

<pre><code>C:\Users\Administrator\Desktop&gt;python ad_create_user.py

Traceback (most recent call last):
  File "ad_create_user.py", line 6, in &lt;module&gt;
    ou = ADContainer.from_dn("ou=users, dc=test, dc=local")
NameError: name 'ADContainer' is not defined

C:\Users\Administrator\Desktop&gt;
</code></pre>

<p>I have installed pyad module. And I am trying this in Windows server 2008 R2.</p>