As an alternative to mjolinor's answer, you can rename the attribute when you select it.
For example, this should work (unverified):
$users = Get-ADUser "joerod" -Properties *|Select-Object SamAccountName, @{Name="PrimaryUserAddress";Expression={$_."msRTCSIP-PrimaryUserAddress"}}
ForEach ($user in $users) {
if($user.PrimaryUserAddress -ne 0){
Write-Host "Removing $($user.samaccountname) from OCS"
}
}
NB: “Name” indicates the new name for the variable, and “Expression” indicates the variable you want to rename.
source
share