Only if msExchHideFromAddressLists is missing from: AD > User > Properties > Attribute Editor
Start > Synchronization Rules Editor
In from AD - User join > Edit > Yes
Precedence: 51 (or higher, up to 99)
Transformations > Add transformation
FlowType: Expression
Target Attribute: msExchHideFromAddressLists
Source:
IIF(IsPresent([msExchAssistantName]),IIF([msExchAssistantName]="HideFromGAL",True,False),NULL)
Save > Yes > OK
PowerShell:
Start-ADSyncSyncCycle -PolicyType Initial
AD > User > Properties > Attribute Editor > msExchAssistantName
HideFromGAL
PowerShell:
Start-ADSyncSyncCycle -PolicyType Delta
$OU = "OU=Archive,OU=Customer,DC=DOMAIN,DC=local"
$AttributeValue = "HideFromGAL"
$users = Get-ADUser -SearchBase $OU -Filter * -Properties msExchAssistantName
$total = @($users).Count
$updated = 0
$skipped = 0
Write-Host "Found $total user(s) in $OU" -ForegroundColor Cyan
foreach ($user in $users) {
if ($user.msExchAssistantName -eq $AttributeValue) {
Write-Host " SKIP: $($user.SamAccountName) - already set" -ForegroundColor DarkGray
$skipped++
continue
}
try {
Set-ADUser -Identity $user -Replace @{ msExchAssistantName = $AttributeValue }
Write-Host " SET: $($user.SamAccountName)" -ForegroundColor Green
$updated++
}
catch {
Write-Host " FAIL: $($user.SamAccountName) - $_" -ForegroundColor Red
}
}
Write-Host "`nDone. Updated: $updated, Skipped: $skipped, Total: $total" -ForegroundColor Cyan
Write-Host "Next step: Run 'Start-ADSyncSyncCycle -PolicyType Delta' on the Azure AD Connect server." -ForegroundColor Yellow