Tuesday 30 March 2021

Get email send/receive statistics of a mailbox in exchange server 2016

To get last 1 days sent emails of a mailbox

Get-MessageTrackingLog -sender nawaz@domain.com -start (Get-date).addday(-1) | messageid -unique | measure

To get last 1 days received emails of a mailbox

Get-MessageTrackingLog -sender nawaz@domain.com -start (Get-date).addday(-1) | messageid -unique | measure

To get last 7 days sent emails of a mailbox

Get-MessageTrackingLog -sender nawaz@domain.com -start (get-date).adddays(-7) | select mes

sageid -unique | measure

To get last 7 days received emails of a mailbox

Get-messageTrackiglog -recipient nawaz@domain.com -start (get-date).adddays(-7) | select messageid -unique | measure

To get last 30 days sent emails of a mailbox

Get-messageTrackiglog -Send nawaz@domain.com -start (get-date).adddays(-30) | select messageid -unique | measure

To get last 30 days received emails of a mailbox

Get-messageTrackiglog -recipient nawaz@domain.com -start (get-date).adddays(-30) | select messageid -unique | measure

Sending data to a remote command failed with the following error message. Exchange 2016

Environment:

Have Hybrid environment, with Exchange Server 2016 and Office 365.

ISSUE:

Want to Search a specific email in all users mailboxes with the following command:  

 [PS] C:\>Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'Subject:"FW:SubjectOfEmail"' -TargetMailbox nawazABC -TargetFolder "inbox\spamitems"


But getting the following Error:  

Sending data to a remote command failed with the following error message: [ClientAccessServer=SERVERNAME,BackEndSer

ver=SERVERNAME.Domain.com,RequestId=9c2cdfdse-4fd7-fds80-8df7-efdsfdsfa,TimeStamp=3/30/2021 7:32:30 AM]

[FailureCategory=WSMan-Others] The total data received from the remote client exceeded the allowed maximum. The

allowed maximum is 524288000. For more information, see the about_Remote_Troubleshooting Help topic.

REASON/Solution:

The Search-Mailbox have some limitations as per the given error that it can return limited number of results. So we have to run our command multiple times, may be for a group of mailboxes, mailbox databases or servers. like as below

1-

Search-Mailbox -identity mailbox1 -SearchQuery 'Subject:"FW:SubjectOfEmail"' -TargetMailbox nawazABC -TargetFolder "inbox\spamitems"

-

Get-Mailbox -database DB1 | Search-Mailbox -SearchQuery 'Subject:"FW:SubjectOfEmail"' -TargetMailbox nawazABC -TargetFolder "inbox\spamitems"

3-

Get-Mailbox -Server Server1 | Search-Mailbox -SearchQuery 'Subject:"FW:SubjectOfEmail"' -TargetMailbox nawazABC -TargetFolder "inbox\spamitems"

Monday 29 March 2021

How to Search and delete an email from a mailbox in exchange server 2016

Environment:

Have exchange 2016 hybrid environment with office 365.

Issue:

A phishing email received to a user and need to be deleted from his mailbox ASAP.

Solution:

Run the following command to delete the email from a mailbox

Search-Mailbox -identity nawazabc -SearchQuery 'Subject:"SubjectOfTheEmail"' -TargetMailbox nawazxyz -TargetFolder "inbox\spamitems" -LogLevel full -DeleteContent

Run the following command to delete the email from the mailbox DataBase

Get-Mailbox -ResultSize unlimited -Database "db1"|Search-Mailbox -SearchQuery 'Subject:"SubjectOfTheEmail"' -TargetMailbox nawazxyz -TargetFolder "inbox\spamitems" -LogLevel full -DeleteContent

To search and delete such emails from Office 365 please look  into this link https://nawazblogger.blogspot.com/2020/07/how-to-search-and-delete-email-from.html 


Get-Mailbox -ResultSize unlimited -Database "db1" | Search-Mailbox -SearchQuery 'Subject:"Security Awareness Module Assigned "Full Social Media Policy""' -deleteContent


Thursday 18 March 2021

Service unavailable, HTTP Error 503. The service is unavailable.

 Environment:

Wanted to publish some services with ADFS and WAP.

ADFS was placed in internal network while WAP was placed in DMZ.

ADFS was configured properly and the default page was accessible internally.

But was getting the following error, while trying the same from the external network.

Error:

Service unavailable, HTTP Error 503. The service is unavailable.

Reason:

TLS 1.0 was disabled on the ADFS server

Solution:

After enabling TLS 1.0 on the ADFS server, the issue was resolved. 

Note: As Registry changes are always critical, so before doing any registry changes, please take backup of your system.




Wednesday 17 March 2021

unable to login ADFS with default page after installation

Issue:

After installing the ADFS role successfully on the server, was unable to logged in to the default login page of ADFS.

i.e

 https://ADFS-url/adfs/ls/idpinitiatedsignon.html

was not accessible

Solution:

After searching on internet came to know that i have to enable the default page with the following power shell command.

So open PowerShell with run as administrator on the ADFS server and run the following command, resolved the issue.

Set-AdfsProperties -EnableIdPInitiatedSignonPage $true


Unable to share any local drive through remote desktop Connection with remote system (Resolved)

  Issues:

1:

Unable to copy any file from local system to a remote system, connected through remote desktop connection

2:

unable to share the local drives with remote system through Remote Desktop Connection

Or

The local drives not visible on the remote system through Remote Desktop Connection

3:

The past option was grayed out

Solution:


After looking in local security policy as below

Type-->GPEDIT.msc in run-->Local computer policy-->computer configuration-->Administrative Templates-->windows components-->Remote Desktop Services-->Remote Desktop Session Host--->Device and Resource Redirection-->Do not allow Drive redirection--option was --Enabled

So after changing option to not configured the above issues were resolved




Unable to copy any file from local system to a remote system, connected through remote desktop connection

 Issues:

1:

Unable to copy any file from local system to a remote system, connected through remote desktop connection

2:

unable to share the local drives with remote system through Remote Desktop Connection

Or

The local drives not visible on the remote system through Remote Desktop Connection

3:

The past option was grayed out

Solution:


After looking in local security policy as below

Type-->GPEDIT.msc in run-->Local computer policy-->computer configuration-->Administrative Templates-->windows components-->Remote Desktop Services-->Remote Desktop Session Host--->Device and Resource Redirection-->Do not allow Drive redirection--option was --Enabled

So after changing option to not configured the above issues were resolved




Tuesday 16 March 2021

your organization has disabled this device.(Resolved)

Issue:

One of office 365 user was trying to open outlook on his system but were getting the following error.

Error: 

Something went wrong, your organization has disabled this device 

To fix this, contact your system administrator and provide the error code 135011


And after clicking on the continue button, on the next page was getting the below error.

We couldn't sign you in. if this error persists. Contact your system administrator and provide the error code CAA20003

Solution:

First i have to note the name of device on which the user was facing the issue.

Then, Go to "https://portal.azure.com" then Azure active directory then All devices--->then search for the device and here the device was disabled. after enabling the device here, the issue was resolved. 


Monday 15 March 2021

Mailbox migration failed with The connection to the server 'autodiscover.domain.com' could not be completed

Issue:

was trying to migrate a mailbox from office 365 to on premises exchange server 2016.

was getting the following error. 

 "The connection to the server 'autodiscover.domain.com' could not be completed"

Resolution:

As recently i had changed the password of the admin user in the migration endpoint.

so after updating the password in the migration endpoint with the following steps the issue was resolved.

Steps:

login to "https://outlook.office.com/ecp"

then Recipients ---> migration-->click the 3 dots and click on Migration Endpoints. double click on the migration endpoint and update the password.

Saturday 6 March 2021

ContentIndexErrorMessage : The Microsoft Exchange Search Host Controller Service is not running on server

After updating Exchange 2016 CU16 to CU19 and applying the "HAFNIUM" security patches, some databases were in Failed state. 

Error 1:

in ECP was getting the error "Content index state: Failed" against the database

Error 2:

in Exchange Shell, running 

Get-MailboxDatabase DatabaseName | Get-MailboxDatabaseCopyStatus | ft Name,*index* 

was getting this error

"ContentIndexErrorMessage     : The Microsoft Exchange Search Host Controller Service is not running on server"

Solution:


After checking the "Microsoft Exchange Search Host Controller" Service on the effected server, found that this "Microsoft Exchange Search Host Controller" was in stopped/disabled state. 

after changing the startup type to automatic of "Microsoft Exchange Search Host Controller" service and starting it and restart the server.

the issue was resolved.