Check if a user has incorrect or missing Custom Attribute Value

 

The following will check members in a group and make sure they have a custom attritbute value

# Connect to Exchange server and load Exchange powershell modules
. 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'
Connect-ExchangeServer -auto
 
Import-Module ActiveDirectory
 
$groupdn = (Get-ADGroup '#Group Name').DistinguishedName
 
$users = Get-ADUser -Filter {(memberof -eq $groupdn)}
 
foreach($user in $users){
 
#If user is not
if($user.name -ne "Users Name"){
 
#if the CustomAttrribte is Blank
if((Get-Mailbox -Identity $user.name | select -ExpandProperty CustomAttribute1) -eq {}) {
#if the CustomAttrribte is not equal to a value
#if((Get-Mailbox -Identity $user.name | select -ExpandProperty CustomAttribute1) -ne "value") {
#Show their name
 ($user.name) } } }

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: custom attribute, email, exchange 2010, group member of, member of group, missing, powershell

Trackback from your site.