[New post] Exchange 2019 / Active Directory :- Update mobile numbers using PowerShell
Edward van Biljon posted: " I was tasked with updating a number of mobile numbers in Active Directory and the easiest way that this was accomplished was by using a CSV file and PowerShell. The CSV consisted of two columns. One for the UPN and another for the mobile number. Wi" Everything-PowerShell
I was tasked with updating a number of mobile numbers in Active Directory and the easiest way that this was accomplished was by using a CSV file and PowerShell.
The CSV consisted of two columns. One for the UPN and another for the mobile number.
With any script, I normally use the -WhatIf statement. On line 9, between the two curly brackets ( } -WhatIf } ) you can put the statement in and this will give you an output of what is being changed.
In the figure below, this is the code used and I have provided it at the end of the article in text format for you to use. Just copy it to notepad and save it as a .PS1 file.
$Users = this is a variable to import the CSV file. The CSV file has a column called UPN and mobile and this is mapped in the lines with $u. $Staff = this is another variable that queries Active Directory (note this was run from a DC, so no modules were imported) The set command uses a replace option (-Replace) to either update an existing number and if nothing exists then the number is simply added.
No comments:
Post a Comment