Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - How to add 0 in the field telephone Number

Reply
 
Old 08-27-2009   #1 (permalink)
Sergio Sbrenna


 
 

How to add 0 in the field telephone Number

Hi all,

I have to change about 3000 user account information (telephone number)
adding the 0 at the start of the number...

I need help to do it in automatic way...

can someone help me???

please...

My System SpecsSystem Spec
Old 08-27-2009   #2 (permalink)
Evertjan.


 
 

Re: How to add 0 in the field telephone Number

=?Utf-8?B?U2VyZ2lvIFNicmVubmE=?= wrote on 27 aug 2009 in
microsoft.public.scripting.vbscript:
Quote:

> I have to change about 3000 user account information (telephone number)
> adding the 0 at the start of the number...
>
> I need help to do it in automatic way...
>
> can someone help me???
for i = 1 to about 3000
telnumberString(i) = "0" & telnumberString(i)
next

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
My System SpecsSystem Spec
Old 08-27-2009   #3 (permalink)
MassimoP


 
 

Re: How to add 0 in the field telephone Number

Sergio Sbrenna wrote:
Quote:

> Hi all,
>
> I have to change about 3000 user account information (telephone
> number) adding the 0 at the start of the number...
>
> I need help to do it in automatic way...
>
> can someone help me???
>
> please...
Hi Sergio,

I suppose you mean changing Active Directory users.
If so, you can simply adapt this script from Microsoft:
http://www.microsoft.com/technet/scr...nda/dec06/hey1
211.mspx

Theoretically is enough to replace the lines:

strTelephone = objUser.telephoneNumber
objUser.Description = strTelephone

with the line:

objUser.telephoneNumber = "0" & objUser.telephoneNumber

and should work (obviously you also need to change
fabrikam.com with your AD domain).

Massimo.

--

My System SpecsSystem Spec
Old 08-27-2009   #4 (permalink)
Richard Mueller [MVP]


 
 

Re: How to add 0 in the field telephone Number


"MassimoP" <nospam@xxxxxx> wrote in message
news:uYbmfdvJKHA.1488@xxxxxx
Quote:

> Sergio Sbrenna wrote:
>
Quote:

>> Hi all,
>>
>> I have to change about 3000 user account information (telephone
>> number) adding the 0 at the start of the number...
>>
>> I need help to do it in automatic way...
>>
>> can someone help me???
>>
>> please...
>
> Hi Sergio,
>
> I suppose you mean changing Active Directory users.
> If so, you can simply adapt this script from Microsoft:
> http://www.microsoft.com/technet/scr...nda/dec06/hey1
> 211.mspx
>
> Theoretically is enough to replace the lines:
>
> strTelephone = objUser.telephoneNumber
> objUser.Description = strTelephone
>
> with the line:
>
> objUser.telephoneNumber = "0" & objUser.telephoneNumber
>
> and should work (obviously you also need to change
> fabrikam.com with your AD domain).
>
> Massimo.
>
> --
>
Good solution. I might just add code so the "0" is only appended if the
telephoneNumber attribute is not blank. For example:
========
Do Until objRecordSet.EOF
strUserPath = objRecordSet.Fields("AdsPath").Value
Set objUser = GetObject(strUserPath)
strTelephone = objUser.telephoneNumber
If (strTelephone <> "") Then
objUser.Description = "0" & strTelephone
objUser.SetInfo
End If
objRecordSet.MoveNext
Loop
--------
And, to get picky, you could modify the query to only return users where
telephoneNumber is not missing.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Maximum number of recipients in BCC field VB Script
Microsoft telephone number Vista mail
Recording from Telephone to CD Help Vista hardware & devices
What is the telephone number to call to check order status? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46