Alias Checker

April 17, 2018 | by iaur | posted as Adminstration, Microsoft 365

MSOL

Get-MsolUser -all | ?{$_.proxyaddresses -match “user@domain.com”}

Get-MsolUser -all | ?{$_.userprinciplename -match “user@domain.com”}

 Get-MsolUser -all | ?{$_.emailaddress -match “user@domain.com”}

Get-MsolContact | Where{$_.UserPrincipalName -match “h****@domain.com”}

Get-MsolGroup -all | ?{$_.proxyaddresses -match “user@domain.com”}

Get-MsolGroup -all | ?{$_.emailaddress -match “user@domain.com”}

Get-MsolUser -All | ? {$_.UserPrincipalNAme -like “user@domain.com”} | fl UserPrinc*,ObjectID

Get-MsolUser -All | ? {$_.ProxyAddresses -match “user@domain.com”} | fl UserPrinc*,ObjectID

Get-MsolContact -All | ? {$_.EmailAddress -eq “user@domain.com”} |fl Objectid

Get-MsolGroup -All | ? {$_.ProxyAddresses -match “user@domain.com”} |fl ObjectId

Get-MsolUser -All -ReturnDeletedUsers | ? {$_.UserPrincipalNAme -like “user@domain.com”} | fl UserPrinc*,ObjectID

Get-MsolUser -All -ReturnDeletedUsers | ? {$_.ProxyAddresses -match “user@domain.com”} | fl UserPrinc*,ObjectID

EXO

Get-recipient | where {$_.emailaddresses  -match  “user@domain.com”} | fl RecipientType,name,emailaddresses

Azure

$val = “user@domain.com”

Get-AzureADUser |?{$_.ProxyAddress -match “$val” -or $_.Mail -match “$val”} |fl

Get-AzureADContact |?{$_.ProxyAddress -match “$val” -or $_.Mail -match “$val”} |fl

Get-AzureADGroup |?{$_.ProxyAddress -match “$val” -or $_.Mail -match “$val”} |fl

To search and delete

PS C:\> Get-MsolUser -all | ?{$_.proxyaddresses -match “faceresionem.xyz”} | Remove-MsolUser -force

PS C:\> Get-MsolUser -all | ?{$_.emailaddress -match “faceresionem.xyz”} | Remove-MsolUser -force

PS C:\> Get-MsolGroup -all | ?{$_.proxyaddresses -match “faceresionem.xyz”} | Remove-MsolGroup -force

PS C:\> Get-MsolGroup -all | ?{$_.emailaddress -match “faceresionem.xyz”} | Remove-MsolGroup -force

PS C:\> Remove-MsolDomain -DomainName faceresionem.xyz -force

PS C:\> Get-MsolDomain