|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Phone number format change...Hello all,
This is my first post in the scripting newsgroup, mainly b/c I am being thrust into the role of scriptor with absolutely ZERO scripting knowledge. Anyway, I've been asked to change the format of the phone numbers from xxx/xxx-xxxx to (xxx) xxx-xxxx. Does anyone know of a way to accomplish this efficiently? Also please keep in mind that the phone numbers are not all the same b/c some are direct numbers and others are the main number with the user's extension following. TIA, Ken On Tue, 16 Jan 2007 08:06:02 -0800, kage13
<kag***@discussions.microsoft.com> wrote: Show quoteHide quote >Hello all, Ken,> >This is my first post in the scripting newsgroup, mainly b/c I am being >thrust into the role of scriptor with absolutely ZERO scripting knowledge. > >Anyway, I've been asked to change the format of the phone numbers from >xxx/xxx-xxxx to (xxx) xxx-xxxx. Does anyone know of a way to accomplish this >efficiently? Also please keep in mind that the phone numbers are not all the >same b/c some are direct numbers and others are the main number with the >user's extension following. > >TIA, > >Ken Regular expressions is likely the way to go. To offer any more specific advice it would be helpful to know how the data is held. Text files? RDBMS? Something else? How many variants are there for the existing number format? Andrew Watt MVP Andrew,
Currently I believe that the phone numbers are manually entered into AD once a phone number has been assigned to a user. I would 'assume' that our phone system would be able to provide some sort of text file or spreadsheet of user /phone number associations that could be used as an input file. More info. for you is that we have over 2800 users and about 15 locations, all of which have their own phone system since we are not using VoIP yet. I guess what I'm after is, is there a way to only script the format change regardless of the data contained in the field? TIA. Show quoteHide quote "Andrew Watt [MVP]" wrote: > On Tue, 16 Jan 2007 08:06:02 -0800, kage13 > <kag***@discussions.microsoft.com> wrote: > > >Hello all, > > > >This is my first post in the scripting newsgroup, mainly b/c I am being > >thrust into the role of scriptor with absolutely ZERO scripting knowledge. > > > >Anyway, I've been asked to change the format of the phone numbers from > >xxx/xxx-xxxx to (xxx) xxx-xxxx. Does anyone know of a way to accomplish this > >efficiently? Also please keep in mind that the phone numbers are not all the > >same b/c some are direct numbers and others are the main number with the > >user's extension following. > > > >TIA, > > > >Ken > > Ken, > > Regular expressions is likely the way to go. > > To offer any more specific advice it would be helpful to know how the > data is held. Text files? RDBMS? Something else? > > How many variants are there for the existing number format? > > Andrew Watt MVP > When you use regular expressions it's crucial to know what the
structure of the existing data contained in the field is. I'm pretty sure that one way to do this would be to use Windows PowerShell *assuming* that the machines have (or can have) .NET Framework 2.0 installed. Some of the others who hang out on the microsoft.public.windows.powershell newsgroup would be better equipped to advise you on the details. If your machines are old (i.e. pre-XP or Windows Server 2003) using PowerShell is potentially problematic. Others on this newsgroup may be able to advise you about alternate approaches. Whichever scripting technique you use getting the regular expression(s) just right is crucial. Andrew Watt MVP On Tue, 16 Jan 2007 08:42:01 -0800, kage13 <kag***@discussions.microsoft.com> wrote: Show quoteHide quote >Andrew, > >Currently I believe that the phone numbers are manually entered into AD once >a phone number has been assigned to a user. >I would 'assume' that our phone system would be able to provide some sort of >text file or spreadsheet of user /phone number associations that could be >used as an input file. >More info. for you is that we have over 2800 users and about 15 locations, >all of which have their own phone system since we are not using VoIP yet. >I guess what I'm after is, is there a way to only script the format change >regardless of the data contained in the field? > >TIA. > >"Andrew Watt [MVP]" wrote: > >> On Tue, 16 Jan 2007 08:06:02 -0800, kage13 >> <kag***@discussions.microsoft.com> wrote: >> >> >Hello all, >> > >> >This is my first post in the scripting newsgroup, mainly b/c I am being >> >thrust into the role of scriptor with absolutely ZERO scripting knowledge. >> > >> >Anyway, I've been asked to change the format of the phone numbers from >> >xxx/xxx-xxxx to (xxx) xxx-xxxx. Does anyone know of a way to accomplish this >> >efficiently? Also please keep in mind that the phone numbers are not all the >> >same b/c some are direct numbers and others are the main number with the >> >user's extension following. >> > >> >TIA, >> > >> >Ken >> >> Ken, >> >> Regular expressions is likely the way to go. >> >> To offer any more specific advice it would be helpful to know how the >> data is held. Text files? RDBMS? Something else? >> >> How many variants are there for the existing number format? >> >> Andrew Watt MVP You also need to specify which attributes in AD are to be modified. User
objects have the following telephone number attributes, corresponding to fields on the "Telephones" tab in ADUC: ADUC field AD user object attribute ---------- ------------------------ Home homePhone Other otherHomePhone Pager pager Other otherPager Mobile mobile Other otherMobile Fax facsimileTelephoneNumber Other otherFacsimileTelephoneNumber IP Phone ipPhone Other otherIpPhone The "other" attributes are multi-valued. All accept any string values. A VBScript program could read and modify any of these, given the rules for converting from the existing values to the new. To modify the attributes for all users, I would use ADO to retrieve the Distinguished Names of all users, and the relevant phone number attributes. In the loop that enumerates the resulting recordset (one row for each user), convert the numbers. If any numbers need modification, bind to the user object, assign the new values, and save the changes. Show quoteHide quote "Andrew Watt [MVP]" <SVGDevelo***@aol.com> wrote in message news:tm0qq2tuccvnf821ka1eemqdlinh0lv0hd@4ax.com... > When you use regular expressions it's crucial to know what the > structure of the existing data contained in the field is. > > I'm pretty sure that one way to do this would be to use Windows > PowerShell *assuming* that the machines have (or can have) .NET > Framework 2.0 installed. Some of the others who hang out on the > microsoft.public.windows.powershell newsgroup would be better equipped > to advise you on the details. If your machines are old (i.e. pre-XP or > Windows Server 2003) using PowerShell is potentially problematic. > > Others on this newsgroup may be able to advise you about alternate > approaches. > > Whichever scripting technique you use getting the regular > expression(s) just right is crucial. > > Andrew Watt MVP > > On Tue, 16 Jan 2007 08:42:01 -0800, kage13 > <kag***@discussions.microsoft.com> wrote: > > >Andrew, > > > >Currently I believe that the phone numbers are manually entered into AD once > >a phone number has been assigned to a user. > >I would 'assume' that our phone system would be able to provide some sort of > >text file or spreadsheet of user /phone number associations that could be > >used as an input file. > >More info. for you is that we have over 2800 users and about 15 locations, > >all of which have their own phone system since we are not using VoIP yet. > >I guess what I'm after is, is there a way to only script the format change > >regardless of the data contained in the field? > > > >TIA. > > > >"Andrew Watt [MVP]" wrote: > > > >> On Tue, 16 Jan 2007 08:06:02 -0800, kage13 > >> <kag***@discussions.microsoft.com> wrote: > >> > >> >Hello all, > >> > > >> >This is my first post in the scripting newsgroup, mainly b/c I am being > >> >thrust into the role of scriptor with absolutely ZERO scripting knowledge. > >> > > >> >Anyway, I've been asked to change the format of the phone numbers from > >> >xxx/xxx-xxxx to (xxx) xxx-xxxx. Does anyone know of a way to accomplish this > >> >efficiently? Also please keep in mind that the phone numbers are not all the > >> >same b/c some are direct numbers and others are the main number with the > >> >user's extension following. > >> > > >> >TIA, > >> > > >> >Ken > >> > >> Ken, > >> > >> Regular expressions is likely the way to go. > >> > >> To offer any more specific advice it would be helpful to know how the > >> data is held. Text files? RDBMS? Something else? > >> > >> How many variants are there for the existing number format? > >> > >> Andrew Watt MVP
Write to file multiple times from Powershell
Migration from vbscript to powershell Getting group members of group on Domain A that contains users on Domain B checking for blocked inheritance in a group of users PowerShell Search in text files Can't log AD user in add a local printer Printer Port Settings ADS_UF_PASSWD_NOTREQD = &h00020 |
|||||||||||||||||||||||