Re: Need to Copy More Attributes from User Template
- From: "sambrake" <sambrake@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Jul 2005 04:39:03 -0700
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
>
>
>
.
- References:
- Need to Copy More Attributes from User Template
- From: eric z
- RE: Need to Copy More Attributes from User Template
- From: sambrake
- Re: Need to Copy More Attributes from User Template
- From: eric z
- Need to Copy More Attributes from User Template
- Prev by Date: Re: MS ADAM: How strategic is a) MS ADAM and b) Authorizaion Manager?
- Next by Date: RE: how to set up root domain A with child domain B?
- Previous by thread: Re: Need to Copy More Attributes from User Template
- Next by thread: Re: SPN not unique
- Index(es):
Relevant Pages
|
Loading