Save the proxyaddresses attribute of users

The PowerShell scripts below allow for the backup of the content of the proxyaddresses attribute of Active Directory users

Backup

#
#	@author: Romain
#	@Description : Exporte le champs proxyAddresses des utilisateurs de l'OU cible $contactou
#	@website : https://rdr-it.com
#	@original source : https://241931348f64b1d1.wordpress.com/2015/10/21/how-to-dump-users-proxyaddresses-attribute-with-powershell/ 
#
ipmo activedirectory
cls 
cd C:\
$contactou = "OU=users ,DC=mondomaine,DC=intra"
$datesuffix = get-date -Format yyy-MM-dd_HHmmss
 
$allcontacts = get-adobject -filter {objectclass -eq "user" } -searchbase $contactou -property DistinguishedName,ObjectGUID,proxyaddresses
 
$allcontacts | select DistinguishedName,ObjectGUID,@{Name='proxyAddresses';Expression={[string]::join(";", $($_.proxyAddresses))}} | export-csv -delimiter ";" -notype alldominocontacts_$($datesuffix).csv
Write-Host "-----------------"
Write-Host "Export termine"

Restore

#
#	@author: Romain 
#	@Description : Import proxyAddresses
#	@website : https://rdr-it.com
#	@original source : https://241931348f64b1d1.wordpress.com/2015/10/21/how-to-dump-users-proxyaddresses-attribute-with-powershell/ 
#
cls
$contactou = "OU=users ,DC=mondomaine,DC=intra"
cd C:\
Import-Csv "alldominocontacts.csv" -delimiter ";" | ForEach-Object{
    $guid = $_.ObjectGUID
    $proxyAddresses = $_.proxyaddresses -split ';'
     
    $find = Get-ADObject -filter {(objectGUID -eq $guid)} -searchbase $contactou -Properties Name,ProxyAddresses
    Write-Host "Utilisateur:"
    Write-Host $find.Name
    Write-Host "Current ProxyAddresses:" $find.proxyaddresses
    Write-Host "Old ProxyAddresses    :" $proxyAddresses
    Set-ADObject -Identity $guid -Replace @{proxyAddresses=$proxyAddresses}    
    Write-Host "-----------------"
    Write-Host
}

 



Related Posts


Exchange 2016: how to set up a DAG
In this tutorial, we'll see how to set up a Database Availability Group (DAG) that makes the Exchange Highly Available (HA) databases available. This feature of Exchange makes it possible to put the databases that host the mailboxes in high availabil

Exchange 2016: Installation and Configuration
In this tutorial, we will see how to install and configure Exchange 2016. Exchange is a mail server designed by Microsoft, it is the professional version of Hotmail (Outlook). Environment An Active Directory domain. A Windows Server 2016 server that

MDT: saving user profiles with USMT
Introduction In this article, we will have how to back up user profiles with MDT during a deployment. Use of this feature is useful in the following cases: Change of computer of a user. Reinstalling the computer Upgrade version of Windows. To save th