<pre><pre>set Args = Wscript.ArgumentsouName = Args(0)
usrName = Args(1)
RUProot = Args(2)
RUPpath = RUProot & " \" & usrName
'Get the domain
Set dse = GetObject(" LDAP://RootDSE" )
Set domain = GetObject( " LDAP://" & dse.Get(" defaultNamingContext" ))
set ou = domain.GetObject(" organizationalUnit" , " OU=" & ouName )
wscript.echo " Creating user in " & ou.Name
set usr = ou.Create(" user" , " cn=" & usrName )
usr.Put " samAccountName" , usrName
usr.Put " userPrincipalName" , usrName
usr.Put " Profilepath" , RUPpath
usr.SetInfo
wscript.echo " User " & usrName & " was created successfully in " & ou.Name & " with a RUP Path of: " & RUPpath</pre></pre>
No comments:
Post a Comment