Showing posts with label Microsoft Exchange. Show all posts
Showing posts with label Microsoft Exchange. Show all posts

Find Exchange CU (Cumulative Update) and SU (Security Update) version

Find Exchange CU (Cumulative Update) version.

Get-ExchangeServer | Format-List Name,Edition,AdminDisplayVersion


Find Exchange SU (Security Update) version.

Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo}




Bulk Add Distribution Group Members

Exchange Online Shell -

Get-Content "C:\New_folder\Members.txt" | Add-DistributionGroupMember salescommunication@xyz.com

===============================================================

$members = get-content "C:\New_folder\distribution.txt"

foreach($user in $members){add-distributiongroupmember -identity "fieldoffices_empmeeitng" -members $user}

Send test attachment email using TELNET


Send test attachment email through TELNET


cat attachment.zip | base64 > zip.txt
cat attachment.pdf | base64 > pdf.txt

# Content-Type: text/csv; name="$FILE"                        # for CSV files
# Content-Type: application/x-msdownload; name="$FILE"    # for executable 
# Content-Type: text/xml; name="$FILE"                        # for xml files or try application/xml

telnet smtp.server.dom 25

HELO
MAIL FROM: email@server.com
RCPT TO: email@server.com
DATA
Subject: Test email
From: email@server.com
To: email@server.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="X-=-=-=-text boundary"

--X-=-=-=-text boundary
Content-Type: text/plain

Put your message here...

--X-=-=-=-text boundary
Content-Type: application/zip; name="file.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="file.zip"

UEsDBBQAAAAIAG1+zEoQa.... copy/paste zip.txt

--X-=-=-=-text boundary
Content-Type: text/pdf; name="file.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="file.pdf"

UEsDBBQAAAAIAG1+zEoQa.... copy/paste pdf.txt

--X-=-=-=-text boundary
.

QUIT

Get Forwarding list

Get Forwarding list


Without mailbox delivery info.

get-mailbox -resultsize unlimited |ft displayname,primary*,forward* -a

Only Forwarding applied mailbox With mailbox delivery info.

get-mailbox | where {$_.ForwardingAddress -ne $null} | select Name, ForwardingAddress, DeliverToMailboxAndForward


GET ALL MAILBOX with delivery info.

get-mailbox -resultsize unlimited |ft displayname,primary*,forward*,DeliverToMailboxAndForward -a

Get Last login details

Get Last login details from list of Email ID

Import-csv .\himanshu.csv |foreach {Get-MailboxStatistics -identity $_.emailid | Select-object DisplayName,LastLogonTime} | Export-CSV c:\lastlogonstatics.csv


For All Mailboxes -

Get-Mailbox -RecipientTypeDetails usermailbox -ResultSize unlimited | foreach {Get-MailboxStatistics -identity $_.UserPrincipalName | Select-object DisplayName,LastLogonTime,WhenCreated,UserPrincipalName,MailboxTypeDetail} | Export-Csv 'D:\scriptresult.csv'


NEW

Import-csv c:\new_folder\himanshu.csv | foreach {$email = $_.emailid 

Get-MailboxStatistics -identity $email | Select-Object DisplayName,@{Name='Email';Expression={$email}},LastLogonTime

} | Export-Csv -Path c:\new_folder\lastlogin-7-5-2024.csv -NoTypeInformation

Exchange 2010: Create mail enabled contacts in bulk

 Source - https://social.technet.microsoft.com/wiki/contents/articles/29968.exchange-2010-create-mail-enabled-contacts-in-bulk.aspx

In Excel create 4 Columns:

  • Name
  • Firstname
  • Lastname
  • ExternalEmailAddress

Contact

Now from the Exchange Management Shell run the following command:

Import-Csv “contacts.csv” | ForEach {New-MailContact -Name $_.Name -Firstname $_.FirstName -LastName $_.LastName -ExternalEmailAddress $_.ExternalEmailAddress -OrganizationalUnit “Domainname/OUname”}


Contact2

In the EMS it will go through the list in the CSV file and create the contacts one by one. If there is a problem with a contact, for example it already exists then an error will be displayed and the import will continue.

How to fix “Exchange deleted mailbox not showing in disconnected”

 

Source - https://www.stellarinfo.com/blog/fix-exchange-deleted-mailbox-not-showing-in-disconnected/

How to fix “Exchange deleted mailbox not showing in disconnected”

Check is by using the PowerShell command below to see the disconnected mailboxes by opening the Exchange Management Shell and running the below

Get-MailboxStatistics -Database “DBNAME” | ?{$_.DisconnectReason -ne $null}

OR

Get-Mailboxdatabase DBNAME | Get-MailboxStatistics | ft

If your mailbox doesn’t show than the issue would be that the Exchange server for a reason it doesn’t process them correctly. To solve this one would need to run the command under the Management Shell to clean-up the database. It’s similar to the action Run Cleanup Agent we had in Exchange 2003. The process will scan the directory for disconnected mailboxes which aren’t yet marked as disconnected in the Exchange store and will update them accordingly.

Clean-MailboxDatabase “dbx01”

If you are using Exchange 2013 onwards the command Clean-MailboxDatabase has been replaced with the below

Update-StoreMailboxStat –Database “dbx01” -Identity “<>”

Now this can be a bit tricky, if you deleted the mailbox how can you get the GUID if it is not visible anywhere? For that you would need to get the information from the Get-MailboxStatistic by using the below format.

Get-Mailbox –Database “dbx01” -IgnoreDefaultScope | Get-MailboxStatistics | ft DisplayName,MailboxGUID

Before proceeding with the commands make sure to advice the users as for this to work the cmdlet needs access to update the mailbox database. This means that the Information store needs to be stopped or if this only affects one mailbox database, it needs to be un-mounted. Depending on the size of the database, the process will take a considerate amount of time apart from the fact that the effected users will not have access to their emails and incoming emails might bounce back to the sender depending if you have an alternative solution to queue emails at your internet provider. When the clean-up process is ready you would need to open the Exchange Management Console and in the disconnected area you should see the mailboxes.

You would then need to create a new Active Directory user to attach the mailbox to and user the Get-MailboxExportRequest PowerShell cmdlet to export the mailbox. There might be occasions that these do not show up and without tearing all your hair from your head, there is an alternate solution using third party Exchange Server Recovery applications.

Third party applications like Stellar Repair for Exchange. This application apart from being the best toolset for any Exchange Administrator, it can help a lot in such cases. Stellar Repair for Exchange is quite a powerful tool where it can recover deleted mailbox from all versions of Exchange Server. It can recover any Exchange EDB file, corrupted or not and you can recover anything from the mailbox store.

You can attach multiple mailbox databases and export directly to a live Exchange server or into an Office 365 mailbox. You can also save the recovered mailboxes to a number of formats such as PST, MSG, EML and PDF. It can process any size of EDB files and supports any Exchange Server version from 5.5 to 2019. It is the definitive bundle of tools for any Exchange Admin as apart from solving these issues, it will surely decrease by 90% the admin effort to recover and of course the downtime for the end user. 

Get Dynamic Distribution Group Details

Get Dynamic Distribution Group Details

Command :

Exchange 2010 -

Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup -identity "OnMobile Global").LDAPRecipientFilter


Exchange 2013 and above -
Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup -identity "OnMobile Global").RecipientFilter

Get all User Details (Displayname EmailAddress Department OU Account Status)

Below command will provide - 

Display Name

SAM Account Name

Email Address

Department

OU Name

Account Status

Command -

Get-User -ResultSize Unlimited | Select displayname,SamAccountName,WindowsEmailAddress,Department,OrganizationalUnit,RecipientType,RecipientTypeDetails | Export-csv c:\Himanshu.csv

VSS Writers Failed (Status and Reason)

 Source - http://support.mozy.com/articles/en_US/FAQ/How-do-I-identify-the-cause-of-my-VSS-error

Check status

  1. Click on Start, then in the Search bar, type cmd.  
  2. When cmd appears at the top of the Start menu, right-click on it and select Run As Administrator.
  3. Type vssadmin list writers into the command prompt, then press Enter.

Explore Event Logs

VSS errors are typically registered within the Windows' event logs.

Type eventvwr.msc into the open command prompt, then press Enter.

Within the Event Viewer there are two logs in which VSS related errors may be chronicled:  The Application Log and the System Log.  Under Windows Vista and Windows 7 these logs will be under the category Windows Logs, while in Windows XP these logs will be immediately viewable.  VSS errors will appear in the Application Log as entries with a source labeled VSS, and in the System Log they will appear with a source labeled volsnap.  For both logs we suggest sorting by source, then look for any items that match either of those source types.  Document the Event IDs associated with these errors, as Internet searches for those Event IDs will provide a good start for finding a resolution to your issue.

Take another look at the logs; determine whether there are any repeating errors.  There are many other issues that can contribute to VSS errors, and they may be listed under different source headings.  Some common service errors that impact VSS deal with the COM+ services, or the MSDTC.  Issues with the hard drive or filesystem can also cause VSS issues.  In particular, look within the System log for any errors under the source disk, ftdisk or ntfs.  If you see any errors or warnings under those source types, you may need to perform a checkdisk.


Mail/Message size limit

Original source - https://docs.microsoft.com/en-us/exchange/mail-flow/message-size-limits?view=exchserver-2019

Organizational limits -

Get-TransportConfig | Format-List MaxReceiveSize,MaxSendSize,MaxRecipientEnvelopeLimit

Get-TransportRule | where {($_.MessageSizeOver -ne $null) -or ($_.AttachmentSizeOver -ne $null)} | Format-Table Name,MessageSizeOver,AttachmentSizeOver

 

Connector limits -

Get-ReceiveConnector | Format-Table Name,Max*Size,MaxRecipientsPerMessage; Get-SendConnector | Format-Table Name,MaxMessageSize; Get-AdSiteLink | Format-Table Name,MaxMessageSize; Get-DeliveryAgentConnector | Format-Table Name,MaxMessageSize; Get-ForeignConnector | Format-Table Name,MaxMessageSize

 

Server limits - 

https://docs.microsoft.com/en-us/exchange/mail-flow/message-size-limits?view=exchserver-2019 

 

Recipient limits -

Get-Mailbox <MailboxIdentity> | Format-List MaxReceiveSize,MaxSendSize,RecipientLimits

 

$mb= Get-Mailbox -ResultSize unlimited; $mb | where {$_.RecipientTypeDetails -eq 'UserMailbox'} | Format-Table Name,MaxReceiveSize,MaxSendSize,RecipientLimits

 
 



 

Simple Mail Flow

 Simple Mail Flow


Health Mailbox Monitoring Mailbox Size Full Issue (Active Sync Deep Test Probe)

Health Mailbox Monitoring Mailbox Size full Issue

Below are some articles related to mentioned issue.

 

Article – https://profadmins.com/2017/01/18/alert-exchange-health-set/

Article – https://docs.microsoft.com/en-us/exchange/management/health/troubleshooting-activesync-health-set?redirectedfrom=MSDN


Clean Up –

Article -- https://social.technet.microsoft.com/Forums/windows/en-US/6d6842fd-c95f-4702-adda-411b860a27bb/exchange-2013-health-mailboxes-cleanup

1. Stop the service which is “Microsoft Exchange Health Manager”
2. Delete all health mailboxes in ADUC 
3. Start the service which is “Microsoft Exchange Health Manager”

 

Article -- https://techcommunity.microsoft.com/t5/exchange-team-blog/exchange-2013-2016-monitoring-mailboxes/ba-p/611004#

  • Open Active Directory Users & Computers
  • Click on View and select “Advanced Features”
  • The Browse to Microsoft Exchange System Objects
  • Verify the presence of the “Monitoring Mailboxes” container.

If the Monitoring Mailboxes container is missing:

  • Make sure you have Exchange Server 2013 CU1 or above installed.
  • Perform PrepareAD with the Exchange Server 2013 version installed.

2) Stop the “Microsoft Exchange Server Health Manager” service on all Exchange Server 2013 servers. 3) Open Exchange Management Shell and use following command to disable existing health mailboxes:

Get-Mailbox -Monitoring | Disable-Mailbox

4) Go back to Active Directory users & computers, right click on domain and search for “HealthMailbox”

5) Delete the health mailbox user accounts.

6) Wait for AD replication or force AD replication.

7) Start the “Microsoft Exchange Server Health Manager” on all Exchange Server 2013 servers.