20090310

<pre><pre>set Args = Wscript.ArgumentsouName = Args(0)
usrName = Args(1)
RUProot = Args(2)

RUPpath = RUProot &amp; " \" &amp; usrName

'Get the domain
Set dse = GetObject(" LDAP://RootDSE" )
Set domain = GetObject( " LDAP://" &amp; dse.Get(" defaultNamingContext" ))

set ou = domain.GetObject(" organizationalUnit" , " OU=" &amp; ouName )

wscript.echo " Creating user in " &amp; ou.Name

set usr = ou.Create(" user" , " cn=" &amp; usrName )
usr.Put " samAccountName" , usrName
usr.Put " userPrincipalName" , usrName
usr.Put " Profilepath" , RUPpath

usr.SetInfo

wscript.echo " User " &amp; usrName &amp; " was created successfully in " &amp; ou.Name &amp; " with a RUP Path of: " &amp; RUPpath</pre></pre>

No comments:

Post a Comment