David,

Novell also do a perl-based script in their Cool Solutions archive if you're interested

http://www.novell.com/coolsolutions/tools/14462.html

Regards,
Mylo

CHIANESE, DAVID wrote:

Steve,
Thanks much for the sample script. -Dave

------------------------------------------------------------------------
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Steve Rochford
*Sent:* Wednesday, December 14, 2005 8:36 AM
*To:* [email protected]
*Subject:* RE: [ActiveDir] csv to ldf converter

Script the whole thing! This script should work - put your own surname in place of mine and you should see that it edits your own details successfully. Then remove the comment from the second sSQL= line and it should process all mailboxes. The "proper" function is a kludge; will take CHIANESE, DAVID and give you Chianese, David; it will also cope with (eg) O'Connor and McCormack type names but I'm sure that there are other scenarios it doesn't know about that need capitals other than after the spaces - this is left as an exercise for the reader :-) Steve set oRS=createobject("adodb.recordset")
set oConn=createobject("adodb.connection")
sConn="provider=ADSDSoObject"
oConn.open sConn
Set oRootDSE=GetObject("LDAP://RootDSE <ldap://RootDSE>")
sRoot=oRootDSE.Get("DefaultNamingContext")
sGroup=wscript.arguments.named("group")
sSQL="select distinguishedname from 'LDAP://" & sRoot & "' where sn='Rochford'" 'sSQL="select distinguishedname from 'LDAP://" & sRoot & "' where objectCategory='person' and objectClass='user' and homeMDB='*' and msExchHomeServerName='*'"
ors.open sSQL, oConn
do while not ors.eof
  sDN=ors("distinguishedname")
  set oUser=getobject("LDAP://" & sDN)
  sDisplayName=proper(oUser.displayName)
  wscript.echo sDisplayName
  oUser.DisplayName=sDisplayName
  oUser.setinfo
  ors.movenext
loop
ors.close

Function proper(s)
 If isnull(s) Or s="" Then
  proper=""
 Else
  a = split(s," ")
  'convert first letters to upper case
  For i=0 To ubound(a)
    a(i)=ucase(left(a(i),1)) & lcase(mid(a(i),2))
if mid(a(i),2,1)="'" then a(i)=left(a(i),2) & ucase(mid(a(i),3,1)) & mid(a(i),4) if left(a(i),2)="Mc" then a(i)=left(a(i),2) & ucase(mid(a(i),3,1)) & mid(a(i),4)
  Next
  s=join(a) 'assumes space
  proper=s
 End If
End Function

------------------------------------------------------------------------
*From:* [EMAIL PROTECTED] on behalf of CHIANESE, DAVID
*Sent:* Tue 13/12/2005 19:11
*To:* [email protected]
*Subject:* RE: [ActiveDir] csv to ldf converter

They are all caps and I want them proper case. Or actually management wants them that way. :) We have this: On 12/13/05, *CHIANESE, DAVID* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: We want this: On 12/13/05, *Chianese, David* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

------------------------------------------------------------------------

Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.12/192 - Release Date: 05/12/2005


List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to