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}

Show all AD users with Displayname and Email Address:

Get-ADUser -Filter * -Properties DisplayName, EmailAddress, Title | select DisplayName, EmailAd
dress

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close