Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Wildcards..

$
0
0

Hi Guys,

As promised, I got back in to the office today and tried this out.

Dave – Thanks very much, did the trick. The only change i had to make, ironically, is that i had to specify "*" as a '-Filter'!

So workable script turned out as;

$users = Get-ADUser -Filter * -Properties proxyAddresses
foreach ($user in $users)
{
    $addressesToRemove = @($user.proxyAddresses) -like '*500*'
    if ($addressesToRemove.Count -gt 0)
    {
        Set-ADUser -Identity $user.DistinguishedName -Remove @{proxyAddresses = $addressesToRemove}
    }
}

Thanks for all your help! Much appreciated.

Adam


Viewing all articles
Browse latest Browse all 13067

Trending Articles