[PS][EX2010] E-mails Recieved per day of Month Report

October 9, 2019 No comments

.Synopsis
E-mail Counting Script v1 by ELAU 10/10/19
– Script counts emails received for each day of the current month
.DESCRIPTION
– Script pulls days of the month and counts number of emails received for each day of the current month or days specified into a HTML report.
– Script allows option to e-mail report
.EXAMPLE
– Run count.ps1 without parameters will prompt for required options
.EXAMPLE
– Specify days to go back without sending email report

count.ps1 -mailbox <mailbox to search> -day <days to search back from today>

.EXAMPLE
– Specify days to go back with sending email report

count.ps1 -mailbox <mailbox to search> -day <days to search back from today> -emailto <report to send to>

 

Categories: Exchange, Powershell Tags:

[PS] [EX2010] Recoverable Folder Size Report

Recoverable Folder Size Report v1

  • Crawls all mailboxes and pulls the recoverableitemsquota size
  • Displays top 10 in HTML report
  • Full CSV report is generated
  • E-mails report with full report

 

Categories: Exchange, Powershell Tags:

[EXCH] Event ID: 9646 User exceeded the maximum of 500 objects of type “objtFolder”.

September 10, 2019 No comments

Shared mailboxes setup in cache mode will download entire content of the mailbox and will register every folder in each cached mailbox toward the objtFolder type limit on the server that’s running Exchange Server. By default, objtFolder limit is set to 500 per-mailbox limit.  Once the limit is exhausted, user will start experiencing the symptoms below:

Symptoms:
– Inbox does not update automatically.
– Folder status bar shows “This folder was last updated on …” instead of “All folders are up to date” message displayed.
– Viewing items in secondary mailbox, new folders and items may not appear or seem to be missing.
– Deleted items still appear in the secondary mailbox like shadow items.
– Degraded performance or random hangs.

Exchange Server (Application log) – Error shows:
Event ID: 9646
Type: Error
Source: MSExchangeIS
Description:
Mapi session “/o=First Organization/ou=Administrative Group/cn=Recipients/cn=user”
exceeded the maximum of 500 objects of type “objtFolder”.

Solution 1: Disable Automap and seperate OST for caching (Preferred method)

1. Remove mailbox permissions
Remove-MailboxPermission -Identity <Mailbox ID1> -User <Mailbox ID2> -AccessRights FullAccess
2. Readd shared mailbox permissions without Automatpping
Add-MailboxPermission -Iden
tity <Mailbox ID1> -User <Mailbox ID2>-AccessRights FullAccess -AutoMapping:$false
3. Readd Mailbox from Mail item in Control Panel.
4.Select your profile, and then click Properties.
5.Click E-mail Accounts.
6.On the E-mail tab of the Account Settings dialog box, click New.
7.In the Choose Service section of the Add New Account dialog box, click E-mail Account, and then click Next.
8. Fill in the e-mail with the shard mailbox
9.Click Finish, click Close, click Close, and then click OK.
10.Start Outlook.

Solution 2: Disable caching of all shared folders (placing shared mailbox in Online Mode)

1.On the File tab, click Account Settings in the Account Settings list.
2.In the Account Settings dialog box, click the E-mail tab and then double-click your Microsoft Exchange Server account.
3.In the Change Account dialog box, click More Settings.
4.In the Microsoft Exchange dialog box, click the Advanced tab.
5.Click to clear the Download shared folders check box.
6.Click OK two times.
7.Click Next, click Finish, and then click Close.
8.Restart Outlook.

Solution 3: Increase the objtFolder count using Registry Key

. Open Registry Editor and navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MSExchangeIS
2. Right click ParametersSystem and create New -> Key
3. Enter MaxObjsPerMapiSession and confirm creation of the new sub-key
4. Right click newly created key, create new DWORD value called objtFolder and give it a decimal value bigger than default 500.
5. Create another DWORD value called objtFolderView and give it the same value.

References:

  • https://support.microsoft.com/en-us/help/3115602/performance-and-synchronization-problems-when-you-work-with-folders-in
  • https://support.microsoft.com/en-us/help/2646504/how-to-remove-automapping-for-a-shared-mailbox-in-office-365
  • https://exutils.blogspot.com/2011/06/exceeded-maximum-of-750-objects-of-type.html
Categories: Exchange Tags:

[EX2010][PS] Recover mail items from Exchange

August 15, 2019 No comments

How do I recover an item after its been deleted? So long as the recoverable items purge duration has not exceeded, you can run the below command to pull e-mails.

For more specific searchquery, reference Advanced Query Syntax (AQS).

  • Email 
  • Meetings 
  • Tasks 
  • Notes 
  • Docs 
  • Journals 
  • Contacts 
  • IM 

 

Categories: Exchange, Powershell Tags:

[PS] Enable TLS 1.2 as default in Powershell

August 5, 2019 No comments

Check Supported protocol

[Net.ServicePointManager]::SecurityProtocol

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

 

Change Net Frame to use TLS 1.2

Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord

Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord

 

Categories: Powershell Tags:

[EX2010] Litigation Hold (Legal Hold)

July 20, 2019 No comments

Litigation Hold (Legal Hold)

Used to preserve mailbox and electronically stored information in anticipation of legal proceedings, investigations, and unspecified reasons. Organizations may be required to inform when a user is placed on litigation hold.

Specifications:

  • Requires Discovery Management or Legal Hold Mgmt (RBAC) to place a mailbox in legal hold
  • Option to enable or disable, no option in 2010 to set start and end dates
  • Original copies are maintained when modified
  • LitigationHoldDate and LitigationHoldOwner attribute is created when enabled
  • Migration to O365: mailboxes on Litigation Hold are preserved after a mailbox is moved

Storage:

When a user deletes a folder other than in the Delete Items folder, the message is ‘moved’. When a user deletes from the Deleted Items folder or does a Shift+Delete (Permanent Deletion), the message disappears from the user’s view, is a ‘soft delete’ and moved to Purge sub-folder of the Recoverable Items folder (Recoverable Items folder is also known as the dumpster in previous versions of Exchange). Recoverable Items folder retains items configured on the mailbox database with a default of 14 days. If Litigation is not enabled, items are purged forever based on reaching the quota limit, or longer than the default or set period.

  • Default Quota for Recoverable Items Folder, Warning: 20GB, Items: 30 GB
  • MFA continues to process the mailbox
  • Deleted items are moved retained in a hidden folder called, Recoverable Items (dumpster) with its own storage, and does not count toward the mailbox quota.
  • Recoverable Items folder has 3 sub-folders:
    1. Deletions: Soft Deleted items are moved here, visible from Recoverable Deleted Items (Visible to users)
    2. Purges: Deleted items from the Recoverable Items are moved here. Deleted Items exceeding the delete item retention period configured on mailbox database or mailbox are also purged here by MFA. Litigation Hold prevents deletion of items from this folder when enabled. (Not visible to users)
    3. Versions: Original copies of mailbox items are copied here by process called copy on write, where in specific properties changes on the item will create a copy. (Not Visible to users)

Enable and Disabling Litigation Hold:

Checking Sizing for mailboxes in litigation hold:

Updating the Size for Recoverable Items when quota is reached:

 

Processing all Mailboxes in litigation hold:

References:

Understanding Litigation Hold

Retention Hold and Litigation Hold in Exchange 2010

Place a Mailbox on Litigation Hold

Categories: Exchange, Powershell Tags:

[PS] Write powershell errors to a text file

June 19, 2019 No comments

Method 1: Try, Catch, Finally

Try: Try to execute a command
Catch: Catches any errors, triggers only for Terminating Errors, so you may need to set a ErrorAction -Stop (EA) for errors that are not terminating.
Finally: Runs regardless if a error occurs.

Method 2: Output error directly to error log 

Method 3: Customize a out-file to a error log

 

Categories: Powershell Tags:

[EXCH] The Cluster service cannot be started. Event ID 1090

June 17, 2019 No comments

  1. Check the Status of Mailbox Servers by running Get-DatabaseAvaliabilityGroup | FL
    1. Inspect servers in stopped and started state
    2. If a mailbox is in a stopped state, you can attempt to stop the individual server by running: Stop-DatabaseAvaliabilityGroup -identity <cluster> -mailboxserver <mailbox server>
  2. Check the status of the  Fail-over Cluster Service Manager
    1. Launch Fail-over Cluster Service Manager > Manage a Cluster > Enter  <cluster>
    2. Expand the <cluster>, review Nodes
    3. If a node is stopped, attempt to ‘Start Cluster Service’
    4. If Cluster Service fails to start, run : Stop-DatabaseAvaliabilityGroup -identity <cluster> -mailboxserver <mailbox server> and perform a Set-DatabaseAvalibilityGroup -identity <cluster>
    5. If the mailbox server fails to be evicted, reboot the server; ensure mailbox databases are dismounted first or maintenance mode is effective.
    6. After the restarting, Perform a force cleanup of the cluster from the failed server.
      1. Log into the failed server, Run Cluster Node “ServerName” /forcecleanup from an elevated command prompt.
  3. Once the cleanup is successful, Attempt to re-add or remove the failed server back into the cluster. You can also try running Start-DatabaseAvailabilityGroup “DAG Name” –MailboxServer “FailedServer” or Stop-DatabaseAvailabilityGroup “DAG Name” –MailboxServer “FailedServer”

 

Categories: Exchange, Powershell Tags:

[O365][PS] Exchange Online Powershell Module and connecting to Exchange Online

May 16, 2019 No comments

Example 1:

Example 2:

 Troubleshooting Errors:

  1. New-ExoPSSession : user_realm_discovery_failed: User realm discovery failed

    • Check proxy settings in IE
  1. New-ExoPSSession: The SSL certificate could not be checked for revocation.

    • Set winhttpbyusingsetproxycommand:
      • Show: netsh winhttp show proxy
      • Set Proxy: netsh winhttp set proxy <proxy url or ip>:<port>
      • Reset Proxy: netsh winhttp reset proxy

 

Categories: Exchange, Office365, Powershell Tags:

[PS] Creating a Key File and Password File

Creating a Key File and Password File

With PowerShell, we can generate a 256-bit AES encryption key:

Creating the AES.key

Creating the password file

Using the key and password file

 

 

 

 

Categories: Powershell Tags: