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