none
Reorder all phone numbers in AD RRS feed

  • Question

  • I am not sure how to phrase this, but Ill give it a try. 

    When I look at a user in AD. On the general tab. We have our internal phone number listed in the telephone number field, if you click on other, we have the external DID number listed. 

    The problem with this, is that with our devices using mobile iron, only the internal field is displayed. I would like to find a script that changes the "order" of these numbers if possible?

    Thank you so much for your help and advice. 

    Tuesday, April 8, 2014 6:50 PM

Answers

  • Hi,

    These users only have one entry in the otherTelephone attribute, correct? The basic idea for this will be to use Get-ADUser to retrieve the information and then Set-ADUser to update the fields.


    EDIT: Here's an example you can build from:

    Get-ADUser tester1 -Properties OfficePhone,otherTelephone | ForEach {
    
        $officePhone = $_.OfficePhone
        $otherPhone = $_.otherTelephone[0]
    
        Set-ADUser -Identity $_ -Replace @{telephoneNumber=$otherPhone;otherTelephone=$officePhone}
    
    }

    I'm using a loop even though this example targets a single user only. I'm doing this is so you can expand this example to process multiple users. As well, there's no real need to use variables, I include them because I think it makes the code easier to read/understand.


    Don't retire TechNet! - (Don't give up yet - 12,830+ strong and growing)

    Tuesday, April 8, 2014 7:00 PM

All replies

  • Hi,

    These users only have one entry in the otherTelephone attribute, correct? The basic idea for this will be to use Get-ADUser to retrieve the information and then Set-ADUser to update the fields.


    EDIT: Here's an example you can build from:

    Get-ADUser tester1 -Properties OfficePhone,otherTelephone | ForEach {
    
        $officePhone = $_.OfficePhone
        $otherPhone = $_.otherTelephone[0]
    
        Set-ADUser -Identity $_ -Replace @{telephoneNumber=$otherPhone;otherTelephone=$officePhone}
    
    }

    I'm using a loop even though this example targets a single user only. I'm doing this is so you can expand this example to process multiple users. As well, there's no real need to use variables, I include them because I think it makes the code easier to read/understand.


    Don't retire TechNet! - (Don't give up yet - 12,830+ strong and growing)

    Tuesday, April 8, 2014 7:00 PM
  • THANK YOU! works flawlessly. 
    Wednesday, April 9, 2014 3:54 PM
  • Wednesday, April 9, 2014 4:36 PM