Export biggest mailbox users with attributes to csv!

This is how: Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select DisplayName,servername,database,StorageLimitStatus, @{name="TotalItemSize (MB)";expression={[math]::Round((($_.TotalItemSize.Value.ToString()).Split("(")[1].Split(" ")[0]. Replace(",","")/1MB),2)}},@{name="TotalDeletedItemSize (MB)";expression={[math] ::Round((($_.TotalDeletedItemSize.Value.ToString()).Split("(")[1].Split(" ")[0]. Replace(",","")/1MB),2)}},ItemCount,DeletedItemCount | Sort "TotalItemSize (MB)"  -Descending | Export-CSV "C:dirAll Mailboxes_120814.csv" -NoTypeInformation Love it!continue reading →

Change upn-suffix for all the users in certain OU

Get-ADUser -Filter {UserPrincipalName -like "*@domain.local"} -SearchBase "OU=whateverisright,DC=contoso,DC=com" | ForEach-Object {     $UPN = $_.UserPrincipalName.Replace("domain.local","newdomain.local")     Set-ADUser $_ -UserPrincipalName $UPN } Easy as opening a banana, right? https://www.youtube.com/watch?v=nBJV56WUDng :)continue reading →

Find unlicensed users with powershell in Office 365 and apply a license.

If you have many users synced to Office 365. It will be more efficient to user powershell to license them. This is how: connect-msolservice and enter crendentials. Get-MsolAccountSku will display the license types. And then: $AccountSkuId = "tenantname:STANDARDWOFFPACK_STUDENT" $UsageLocation = "FI" $LicenseOptions = New-MsolLicenseOptions -AccountSkuId $AccountSkuId $Users = Get-MsolUser -All…continue reading →

Exchange 2010 – Purge Deleted Items before retention limit kicks in.

Get all users Deleted Items size: Get-MailBox | Get-MailboxStatistics | select DisplayName,TotalDeletedItemSize Get a specific users Deleted Items Size: Get-MailboxStatistics <alias> | select DisplayName,TotalDeletedItemSize Purge All Users Deleted Items: get-mailbox | Search-mailbox -SearchDumpsterOnly -DeleteContent Purge a specific users Deleted Items: Search-mailbox -identity <alias> -SearchDumpsterOnly -DeleteContent    Check Database white space…continue reading →

Add SIP address to all users in certain OU

This situation may come true if you have Onpremises Exchange and Online tenant Lync. Then you need to add a SIP address with the same name as the user is in the Online tenant. And here's the script: $mailboxes = Get-Mailbox -OrganizationalUnit contoso.local/Users/someOU foreach ($mailbox in $mailboxes) {Set-Mailbox -Identity $mailbox…continue reading →