RE: Change of set display name

Tech-Archive recommends: Fix windows errors by optimizing your registry



add following line:
objUser.setInfo

after this line:
objUser.Put "displayName", givenName + " " + sn

Just missed it in the script...

--
When you are unable to keep your eyes open, do go and sleep for few hours!!!


"Umesh Thakur" wrote:

> Use the following code to change displayName of ALL USERS in given OU:
> (specially modified for you) :)
>
> Const ADS_PROPERTY_UPDATE = 2
> objOU="ou=Staff,dc=fabrikam,dc=com"
>
> set objOU = GetObject("LDAP://"; & objOU) 'get a reference to the OU
> for each objUser in objOU 'Loop through all OBJECTS in referenced OU
> If objUser.Class="user" Then 'If object in OU is User,
> Set objUser = GetObject("LDAP://"; & objUser.distinguishedName)
> 'Set displayName...
> objUser.Put "displayName", givenName + " " + sn

> End if
> next
>
> Regards,
> Umesh
>
> --
> When you are unable to keep your eyes open, do go and sleep for few hours!!!
>
>
> "MooNBeaR" wrote:
>
> >
> > I have a whole bunch of users that were created from this script:
> > [url]http://www.rlmueller.net/CreateUsers.htm[/url]
> >
> > Problem is, it put the First Name and Last Name attribute in for all
> > the users, but the Display Name is left blank.
> >
> > I need something that will go to a specific OU and set the Display Name
> > to:
> >
> > First Name + " " + Last Name
> >
> > for each user in that OU.
> >
> > How would I do this... I'm just learning, and here's what I have so far
> > - I am trying...
> >
> > ========= CODE START =========
> >
> > Const ADS_PROPERTY_UPDATE = 2
> > Set objUser = GetObject _
> > ("LDAP://ou=Staff,dc=fabrikam,dc=com";)
> >
> > objUser.Put "displayName", givenName + " " + sn
> >
> > ========== CODE END ==========
> >
> > I know, it's probably not even close, and it still has to loop through
> > all the users in the OU. Can someone please help? TIA.
> >
> >
> >
> > --
> > MooNBeaR
> > ------------------------------------------------------------------------
> > Posted via http://www.codecomments.com
> > ------------------------------------------------------------------------
> >
> >
.



Relevant Pages

  • Re: Text window not displaying inside loop
    ... The sleep isn't going to help you any. ... You'll either have to do a message pump or do your busy stuff in a thread. ... functionality to loop every X-seconds then checking the figures again. ... trying to display them fresh on each loop to a text box. ...
    (microsoft.public.vc.mfc)
  • Re: Text window not displaying inside loop
    ... There is no need for a thread, there is no need for a Sleep, ... there is no need for a PeekMessage, you have built a complicated solution to a truly ... I'm not sure I understand the fixation on a loop to do this. ... The display is for the benefit of whoever ...
    (microsoft.public.vc.mfc)
  • Expect looking for a loop of some kind.
    ... must make a very similar script except now I must make it available ... while statement or a loop of some kind so that it will continue ...
    (comp.lang.tcl)
  • Re: Record active sessions via WMI but with a twist
    ... stop the do loop as soon as the specified time is reached? ... The problem is i want this to monitor active sessions reporting every ... onto the next section of the script. ... if it is calculate the time to sleep until 12:30" do you mean get the ...
    (microsoft.public.scripting.vbscript)
  • Re: Pause program
    ... starting a BackgroundWorker with a "sleep" loop, ... fall through and display my message with ShowDialog. ... a form.showdialog halts everything before the timer starts. ...
    (microsoft.public.dotnet.languages.vb)