Emails in users “Inbox” are automatically moved to a folder (not created by user), labeled “Junk”

Scenario:

A new email arrives, it sits in the “Inbox” anywhere from a few seconds to a few minutes before it moves to a folder labeled “Junk”. This is not the default “Junk E-Mail” folder in Outlook/OWA.

Issue:

Client has a Samsung Galaxy device configured to view users mailbox.

Solution: 

  1. Go into the E-Mail application on the Samsung Galaxy
  2. Press the Menu Key, select Settings, then General Settings
  3. Select Spam addresses and remove any addresses that should not be in there, such as your corporate domain.

Advertisement

Perform IIS reset on multiple servers at once.

Perform IIS reset on multiple servers at once. Displays status after reset. 
#Specify servers in an array variable, Make sure you change the where statement.
[array]$servers = get-exchangeserver | where {$_.identity -like “esg*” -and $_.AdminDisplayVersion -match “version 15.0*”}

#Step through each server in the array and perform an IISRESET
#Also show IIS service status after the reset has completed

foreach ($server in $servers)
{
    Write-Host “Restarting IIS on server $server…”
    IISRESET $server
    Write-Host “IIS status for server $server”
    IISRESET $server /status
}
Write-Host “IIS has been restarted on all servers”
OR

#Specify servers in an array variable
[array]$servers = “Server1″,”Server2″,”Server3″,”Server4”
#Step through each server in the array and perform an IISRESET
#Also show IIS service status after the reset has completed
foreach ($server in $servers)
{
    Write-Host “Restarting IIS on server $server…”
    IISRESET $server
    Write-Host “IIS status for server $server”
    IISRESET $server /status
}
Write-Host IIS has been restarted on all servers

The attempt to connect to http://server/powershell using “Kerberos” authentication failed: Connecting to remote server failed with the following error message: The WinRM client cannot process the request because the server name cannot be resolved

Error message: The attempt to connect to http://server/powershell using “Kerberos” authentication failed: Connecting to remote server failed with the following error message: The WinRM client cannot process the request because the server name cannot be resolved
Resolution: Try any of the options below
  
Option 1: 
Close console
Delete:  “C:Users[User Profile]AppDataRoamingMicrosoftMMCExchange Managment Console”
Try connecting again. It should re-query the servers
Option 2:
Close EMC
Delete the following registry value from the server: 
  HKCUSoftwareMicrosoftExchangeServerv14AdminToolsNodeStructureSettings
Reopen your EMC .
Option 3
If you know a working server’s name, launch the console
Right Click on Microsoft Exchange, Click on Add Exchange forest
Under specify the FQDN or URL running the remote powershell instance, type the fqdn of the server

Click OK

Some Powershell One-Liners

​Run this one liner command to disable client access to a mailbox
Set-CASMailbox “testmbox” -EwsEnabled $false -ActiveSyncEnabled $false -MAPIEnabled $false -OWAEnabled $false -ImapEnabled $false -PopEnabled $false
Disable single item recovery and remove the mailbox from litigation hold.
 
Set-Mailbox “Mickey Mouse” -SingleItemRecoveryEnabled $false -LitigationHoldEnabled $false
 
Copy items from the Recoverable Items folder to a folder in the Discovery Search Mailbox and delete the contents from the source mailbox.
 
Search-Mailbox -Identity “testmbox” -SearchDumpsterOnly -TargetMailbox “Discovery Search Mailbox” -TargetFolder “GurinderSingh-RecoverableItems” -DeleteContent
  
If you need to delete only messages that match specified conditions, use the SearchQuery parameter to specify the conditions. This example deletes messages that have the string “card statement” in the Subject field.
 
Search-Mailbox -Identity “testmbox” -SearchQuery “Subject:’card statement'” -SearchDumpsterOnly -TargetMailbox “Discovery Search Mailbox” -TargetFolder “testmbox-RecoverableItems” -DeleteContent

Reporting Mailbox Folder sizes with Powershell

​Reporting Mailbox Folder sizes with Powershell
report on individual folders and sizes:
Get-MailboxFolderStatistics testmbox
get folder stats and display folder size and items in folder:
Get-MailboxFolderStatistics testmbox | Ft name,FolderSize,ItemsinFolder
look at specific folders and sub folders:
Get-MailboxFolderStatistics testmbox -FolderScope Inbox | Select Name,FolderSize,ItemsinFolder

Importing pst to mailbox

Scenario: Import pst into a mailbox
Note: Must have mailbox export/import permissions to be able to do this. targetrootfolder is good if you are importing multiple psts into the mailbox. This way content is not merged under existing folders.
From Powershell, type:
New-MailboxImportRequest -Mailbox newmbox -filepath serverpstfilesnewmbox.pst-BadItemLimit 50 -T
argetRootFolder “Mailbox -newmbox”

Search IIS logs for ActiveSync data for specific user accounts.

Scenario: You want to find ActiveSync activity for specific users that is stored in IIS logs on the Exchange Servers.

 
Using LogParser you can edit and run the following command:
 
logparser “Select * from ‘servernamec$inetpublogslogfilesw3svc1*.log’ Where cs-uri-stem LIKE ‘%Microsoft-Server-ActiveSync%’ AND (cs-uri-query LIKE ‘%username1%’ OR cs-uri-query LIKE ‘%username2%’)” -i:IISW3C -q:on >FilePathfilename.txt

Check the Event Viewer from PowerShell

Below are examples of checking the event viewer via PowerShell.
Running local with event id and date range
Get-WinEvent -FilterHashtable @{logname=’application’;id=4107;StartTime=”1/15/11″;EndTime=”1/17/11″}
 
Running on remote computer with event ID
Get-WinEvent -computername <remote computer> -FilterHashtable @{logname=’application’;id=15006}

Creating Exchange Databases and creating Database Copies in Exchange Powershell

Task: To create Exchange DB’s and DB Copies, follow the following powershell commands below. Note everything with this highlight will need your adjusting.

Create the DB:
New-MailboxDatabase dbname -Server servername -LogFolderPath C:dbfolderLogs -EDBFilePath C:dbfolderDBdbname.edb 
Mount the DB:
Mount-Database dbname 
Add the DB Copies to other DAG members:
Add-MailboxDatabaseCopy dbname -MailboxServer PassiveServerName -ActivationPreference 2 
Add-MailboxDatabaseCopy dbname -MailboxServer PassiveServerName -ActivationPreference 3 
Add-MailboxDatabaseCopy dbname -MailboxServer PassiveServerName -ActivationPreference 4