locked
Update user information in AD using CSV RRS feed

  • Question

  • Hello ,

    I want to update bulk users in the active directory using CSV ihave already update all users fax but still i cant update the telephone number and ip phone fields 

    the file format :--

    SamAccountName,TelephoneNumber
    a.mark,7740
    a.mado,8068

    using this CMDLET through power shell  :-

    Import-Module ActiveDirectory
    $USERS = Import-CSV c:\Feedad\fax-telephone.csv
    $USERS|Foreach{Set-ADUSer -Identity $_.samaccountname -FAX $_.Telephonenumber}

    and it works but when i replace -FAX with -ipPhone  it's not working also with -TelephoneNumber !

    Please Advice .

    Wednesday, February 12, 2014 11:52 AM

Answers

  • it works after using replace only the previous command doesn't replace the old value !

    Import-Module ActiveDirectory

    $Userscsv =  Import-Csv "C:\Fax-Telephone.csv"

    ForEach ($User in $Userscsv)

    {
         Set-ADUser  $User.sAMAccountName -Replace @{telephonenumber  = 

    $User.telephoneNumber}
     }

    thanks Paul,

    • Marked as answer by M.Bahloul Thursday, February 13, 2014 8:57 AM
    Thursday, February 13, 2014 8:38 AM

All replies

  • If you haven't already done this, I would verify that the $_.telephonenumber had a value.

    ForEach...{$_.samAccountName
                    $_.telephoneNumber}

    This ensures you haven't spelt something wrong or some other issue that isn't populating the variable


    Paul Bergson
    MVP - Directory Services
    MCITP: Enterprise Administrator
    MCTS, MCT, MCSE, MCSA, Security, BS CSci
    2012, 2008, Vista, 2003, 2000 (Early Achiever), NT4
    Twitter @pbbergs http://blogs.dirteam.com/blogs/paulbergson
    Please no e-mails, any questions should be posted in the NewsGroup.
    This posting is provided AS IS with no warranties, and confers no rights.

    Wednesday, February 12, 2014 1:01 PM
  • it works after using replace only the previous command doesn't replace the old value !

    Import-Module ActiveDirectory

    $Userscsv =  Import-Csv "C:\Fax-Telephone.csv"

    ForEach ($User in $Userscsv)

    {
         Set-ADUser  $User.sAMAccountName -Replace @{telephonenumber  = 

    $User.telephoneNumber}
     }

    thanks Paul,

    • Marked as answer by M.Bahloul Thursday, February 13, 2014 8:57 AM
    Thursday, February 13, 2014 8:38 AM