Re: Need to Copy More Attributes from User Template



If the home folder attribute (homeDirectory) has the setting on the template
user then you can add it to the attributes to be copied. Here is the line
from the script that will do that:

arrAttributes = Array("description", "wWWHomePage", "department",
"company","homeDirectory")

"eric z" wrote:

> Thanks a lot, Brian!
>
> Just a quick question: will this method also create the user's home folder
> automatically if the template is using %username%, or I have to create the
> new user's home folder manually? Please let me know.
>
> Thanks again,
>
> Eric
>
> "sambrake" <sambrake@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:1194EE2D-E72D-4F6F-8376-0662D527EABD@xxxxxxxxxxxxxxxx
> >
> >
> > "eric z" wrote:
> >
> > > Hi,
> > >
> > > When we create new users by copying from templates, we found some
> attributes
> > > which were copied in User Manage for Domain (NT), such as Description,
> and
> > > some new attributes, such as Street, will not be copied to the new
> accounts.
> > >
> > > I found the following info from Microsoft Windows 2000 Scripting Guide:
> > >
> http://www.microsoft.com/technet/scriptcenter/guide/sas_usr_cioj.mspx?pf=true
> > >
> > > "Another way of completing the copy user account task is by using the
> schema
> > > attribute of IADs to determine which attributes of the user class are
> > > optional, then check the template user account to determine which of
> these
> > > attributes contain values. For those that do contain values, write those
> > > values to the new user account object. This approach does not require
> you to
> > > define the specific attributes you want assigned to the new user
> account."
> > >
> > > I believe this will solve my problem. Does any know any detail info
> about
> > > this approach and can provide me the link to it?
> > >
> > > Thanks in advance,
> > >
> > > Eric
> > >
> > >
> > >
> >
> > I will explain what the script does step by step and it may help. You can
> > determine the attribute names that you would like to copy from a template
> > user by using ADSIEdit.
> >
> > Set objOU = GetObject("LDAP://ou=HR,dc=NA,dc=fabrikam,dc=com";)
> > *******This is the OU where the new user will be created
> > Set objUser = objOU.Create("User", "cn=BarrAdam")
> > *******Creates the new user BarrAdam
> > objUser.Put "sAMAccountName", "barradam"
> > *******Puts the logon name as barradam
> > objUser.SetInfo
> > *******Saves the information in AD
> >
> > Set objUserTemplate = _
> > GetObject("LDAP://cn=HRUser,ou=HR,dc=fabrikam,dc=com";)
> > *******Gets the user account that is used as a template
> > arrAttributes = _
> > Array("description", "wWWHomePage", "department", "company")
> > *******Defines what attributes to copy to the new user
> > objUserTemplate.GetInfoEx arrAttributes, 0
> > *******Reads the values of the attributes from the template user
> >
> > For Each strAttrib in arrAttributes
> > strValue = objUserTemplate.Get(strAttrib)
> > objUser.Put strAttrib, strValue
> > Next
> > *******Puts the attribute values from the template user into the new user
> >
> > objUser.SetInfo
> > *******Saves all of the information in AD
> >
> > You can modify the script to accept a new username or template user via
> the
> > command line as well using wscript.aguments so you don't need manually put
> > the names into the script.
> >
> > Wscript.arguments Information:
> >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsproarguments.asp
> >
> > Info on Active Directory Attributes:
> >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/a_allowedattributes.asp
> >
> > Info on using ADSIEdit:
> >
> http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/ebca3324-5427-471a-bc19-9aa1decd3d40.mspx
> >
> > Hope this helps,
> >
> > Brian Brake
> > MCSE
>
>
>
.



Relevant Pages

  • RE: User Account Template Question
    ... You are correct in that the template will show it ... > option to create a new user account, it will in fact create the profiles and ... using the Userid Variable and it does not work on it. ... >>> defining a user's home folder and profile. ...
    (microsoft.public.windows.server.active_directory)
  • RE: Need to Copy More Attributes from User Template
    ... > "Another way of completing the copy user account task is by using the schema ... then check the template user account to determine which of these ... I will explain what the script does step by step and it may help. ... objUser.Put strAttrib, strValue ...
    (microsoft.public.windows.server.active_directory)
  • Re: Need to Copy More Attributes from User Template
    ... automatically if the template is using %username%, or I have to create the ... >> "Another way of completing the copy user account task is by using the ... > I will explain what the script does step by step and it may help. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Error user wizard - folder redirection
    ... 294667 "Home Folder" error when running the Add User Wizard ... > Entering the Account Committer... ... > Entering the Template Committer... ...
    (microsoft.public.windows.server.sbs)
  • Re: users default home folder
    ... Windows Registry Editor Version 5.00 ... Set the My Documents location. ... >How can I set users default home folder on another drive eg. ... I simply created a Template in which I specify ...
    (microsoft.public.windows.server.sbs)

Loading