POWERSHELL

 

One-liners:

Show all users in Active Directory with “password never expires”:

Show last login time, in sorted format for computerobjects:

Show last login time, in sorted format for userobjects:

Getting number of Excahnge mailboxes, with or wirhout shared:

Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox,SharedMailbox | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object Name | Format-Table -Auto

For removing a email alias, already “stamped” on your users in Exchange via email address policies:

$allmailboxes = get-mailbox
$allmailboxes |% {$a = $_.emailaddresses; $b = $_.emailaddresses; foreach ($e in $a) {if ($e.tostring() -match “removethisdomain.com”) {$b -= $e;}}$_ | set-mailbox -emailaddresses $b}