Press "Enter" to skip to content

Save the proxyaddresses attribute of users

0

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 : http://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 : http://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 Post

GLPI: add custom fields In this tutorial, we will see how to add custom fields using the Fields plugin. Fields allows you to add custom field blocks in the different eleme...
Administer Windows Remote Server in PowerShell wit... Introduction In this tutorial, we will see how to remotely administer a Windows server in PowerShell (Powershell remoting) with PSSession. PSSessi...
Veeam – extracting a backup with the Export ... Introduction With version 9.5u4, a new feature has been added to Veeam which is the Export Backup. The export backup is used to extract (export) f...
Exchange Minimal / Express hybrid migration to Off... Presentation This article shows you how to migrate your local Exchange environment to Office 365. The advantage of this migration is to be transpa...
It looks like you're using an adblocker.
We use ads to keep our content free. Please support us by turning off your adblocker.