Advertisement
Guest User

Untitled

a guest
May 27th, 2015
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. $validDomains = "*example.com", "*test.com", "*abc.com"
  2. Get-QADUser -IncludedAttributes "proxyAddresses" | foreach {
  3. $account = $_.Identity
  4. $_.proxyAddresses | foreach {
  5. if ($_ -notlike $validDomains[0] -and $_ -notlike $validDomains[1] -and $_ -notlike $validDomains[2]) {
  6. $address = $_
  7. if ($address -like "SMTP*") {
  8. Write-Host "Removing SMTP address $_ from $account"
  9. Set-QADUser -Identity $account -ObjectAttributes @{proxyAddresses=@{Delete=@("$_")}} -whatif
  10. }
  11. }
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement