This script removes Active Directory objects for HealthMailboxes or SystemMailboxes in the Microsoft Exchange System Objects (MESO) container that do not have a homeMDB attribute set.
It is highly recommended to run the script with -WhatIf parameter to check objects first.
Information about accounts deleted or supposed to be deleted are written to a log file.
# EXAMPLE # Perform a WhatIf run in preparation to removing SystemMailboxes having an empty database attribute .\Remove-OrphanedMailboxAccounts.ps1 -SystemMailbox -WhatIf # EXAMPLE # Remove HealthMailbox(es) having an empty database attribute .\Remove-OrphanedMailboxAccounts.ps1 -HealthMailbox
2017-02-10 10:18: 11488 - Info - Script started 2017-02-10 10:18: 11488 - Info - WhatIf Preference: True 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | 10 objects found 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailboxd32b165a6adf45518c8498fba3c7c93a,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailbox6b66930902d8430e831df7b086bfd49b,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailbox6bf99bdc31474217a6fdc4cd83260e88,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailboxd4410bf131b34907b6a96a7e65263db1,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailbox98f334580dbf457ca2a6d1a19fdf49d1,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailboxc16704bf98c94f5e8453c7955d7897b5,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailboxa64fe085bdff46a786d68782c5070bf1,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailbox6c56f94506974a1183c6b71eebb63406,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailbox9b6666d46aa746e3848f3240e418d731,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Cleaning HealthMailboxes | Delete CN=HealthMailboxb2bd3d4725b249bab81eeed35666de0f,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de 2017-02-10 10:18: 11488 - Info - Script finished
This script removes the proxy address(es) for a selected protocol from mail-enabled public folders.
Any proxy address with a given protocol is removed from the proxy addresses list.
The script can fix the alias of mail-enabled public folders as well. The code used is based upon a blog post by Shay Levy.
# EXAMPLE 1 # Check mail enabled public folders for proxy addresses having "MS:" as a protocol type. # Do not remove and update addresses, but log found addresses to RemovedAddresses.txt .\Clean-MailEnabledPublicFolders.ps1 -ProtocolToRemove "MS:*" # EXAMPLE 2 # Check mail enabled public folders for proxy addresses having "MS:" as a protocol type. # Remove and update addresses and log found addresses to RemovedAddresses.txt .\Clean-MailEnabledPublicFolders.ps1 -ProtocolToRemove "MS:*" -UpdateAddresses
This Powershell script has been optimized using the ISESteroids™ add-on. Learn more about ISESteroids™ here.
This script removes/disables HealthMailboxes that show an inconsistent error when querying monitoring mailboxes using
Get-Mailbox -Monitoring
and receiving a warning like
"WARNING: The object DOMAINNAME/Microsoft Exchange System Objects/Monitoring Mailboxes/Health_Mailbox_GUID has been corrupted,
# Remove the HealthMailbox(es) having an empty database attribute .\Fix-HealthMailboxes.ps1 -Remove
When you mail enable an Exchange legacy public folder, a system object is created in Active Directory which is stored in the so-called MESO object container
The object created contains all required attributes for Exchange address lists and other Exchange attributes.
When you mail disable a public folder Exchange Server is supposed to delete the MESO object as well. For some reason that might not happen. In this case, the public folder will show in Public Folder Management Console as mail disabled, is still capable of receiving emails sent to its email address.
From an Exchange perspective, the email address can still be resolved, because a system object containing the email address still exists.
At first, it looked like a permission issue on the MESO object container, but it wasn’t.
A Microsoft KB article described the issue for a single forest, multi-domain environment, and a similar issue with Exchange Server 2010.
Configure the following registry on each Exchange Server hosting a public folder database and restart the MSExchangeIS service.
In addition, you should name the public folder and domain controller in the Exchange cmdlet
Enable-MailPublicFolder “\Public Folder Name” –Server PUBLICFOLDERSERVER –DomainController DC01
When you mail enable an existing public folder which looks like being mail disabled but still having an (old) MESO object, a new MESO object will be created. The situation will be as follows:
The result is not necessarily as expected, as the old MESO object is orphaned and never reconfigured again.
Orphaned objects need to be cleaned up manually and being recreated again, if necessary. In an Exchange environment that has been migrated from ancient versions to 2010, you might already have a lot of MESO objects having digits added to their common names.
You can clean up the MESO objects as follows:
This results in a correctly named and configured MESO object. You can use Bill Long’s PowerShell script to identify orphaned public folder objects in the MESO container.
This information is related to legacy Exchange public folders being hosted on Exchange Server 2007 and/or Exchange Server 2010.
The solution has been validated for Exchange Server 2007 as well, even though the KB article has been published for Exchange Server 2010 only.
This post had originally been posted at my former blog SF-Tools.
Do you need assistance with your Exchange Server setup? You have questions about your Exchange Server infrastructure and going hybrid? You are interested in what Exchange Server 2019 has to offer for your environment?
Contact me at thomas@mcsmemail.de Follow at https://twitter.com/stensitzki
This script searches for OOF rules created by users using the Outlook rule-tab in the OOF assistant and deletes exisiting OOF rules.
In preparation to configure compliant Out-Of-Office (OFF) settings for users, any existing OOF rule needs to be deleted. The script will use either an exisiting Exchange Server EWS library or the Managed EWS library installed using the default file path.
This is the first of two scripts for the complete solution. Find the second script here.
The script access the mailbox rules using Exchange Web Services. Therefore the account executing the script either needs to have ApplicationImpersonation rights or full access to the user mailbox.
# EXAMPLE 1 # Find any existing OOF rule and write results to log file Remove-OOFRule # EXAMPLE 2 # Find and delete any existing OOF rules in all user mailboxes and write delete actions to log file Remove-OOFRule -Delete # EXAMPLE 3 # Find and delete any existing OOF rules for user SomeUser@varunagroup.de and write delete actions to log file Remove-OOFRule -Mailbox SomeUser@varunagroup.de -Delete
Rhoderick Milne (https://blogs.technet.microsoft.com/rmilne)
This script reads the Exchange schema version from the Active Directory schema partition.
The Exchange organization name is fetched from Active Directory automatically. The script fetches at forest level:
The script fetches at domain level:
Code Samples
# Fetch all version information in the Active Directory forest .\Get-ExchangeServerVersionInfo.ps1
Sample Output:
PS D:\Scripts> .\Get-ExchangeServerVersionInfo.ps1 Exchange Server Schema and Object Information for forest [VARUNA.ROOT] Exchange Organization Name : VARUNA-GROUP Active Directory Schema rangeUpper: 15332 Working on VARUNA.ROOT MESO Container objectVersion : 13236 Exchange Configuration msExchProductId : 15.01.1466.003 Exchange Configuration objectVersion : 16213 Working on VARUNAGROUP.DE MESO Container objectVersion : 13236
Enjoy Exchange Server!
This script deletes user from the NoSpamProxy NoSpamProxyAddressSynchronization database table [Usermanagement].[User] table that have not been removed by the NoSpamProxy Active Directory synchronization job.
The script was developed due to a process flaw in how Active Directory accounts are handled as part of a leaver process. So this script does not fix a software bug, but a process glitch.
Due to the Active Directory account process the accounts still exist in Active Directory and are synchronized to the NoSpamProxyAddressSynchronization database.
When executed without the -Delete parameter all identified users are wirtten the log file only.
# EXAMPLE 1 # Check for Active Directory existance of all users stored in NoSpamProxy database. Do NOT delete any users from the database. .\Remove-NspUsers.ps1 # EXAMPLE 2 # Delete users from NoSpamProxy database hosted on SQL instance MYNSPSERVER\SQLEXPRESS that do NOT exist in Active Directory. .\Remove-NspUsers.ps1 -Delete -SqlServerInstance MYNSPSERVER\SQLEXPRESS