Hitta E-post och proxy adresser

Funktion
function Get-EmailAddress
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True,
HelpMessage = 'What e-mail address would you like to find?')]
[string[]]$EmailAddress
)

process
{
foreach ($address in $EmailAddress)
{
Get-ADObject -Properties mail, proxyAddresses -Filter "mail -like '*$address*' -or proxyAddresses -like '*$address*'"
}
}
}

http://powershellblogger.com/2015/10/find-any-e-mail-address-or-proxy-address-in-active-directory/

Ta bort felaktig proxy adress
Set-ADUser -Remove @{proxyAddresses="MBX:1"}

Advertisements